-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REFACTOR Caching #16
base: master
Are you sure you want to change the base?
REFACTOR Caching #16
Conversation
@@ -20,8 +20,11 @@ adapter.invalid-publication-channels=internal | |||
# opencast.external-api.uri=https://{organization}.api.opencast.com | |||
# opencast.external-api.user=admin | |||
# opencast.external-api.password=password | |||
# opencast.external-api.max-cache-size=1000 | |||
# opencast.external-api.cache-expiration-duration=PT0M | |||
##Cache duration. When set to PT0M, cache is disabled. Min. Caching is one minute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the minimum cache time? Does PT0M disables the caching or not?
cacheDir = new File(opencastCacheDir); | ||
} | ||
|
||
long cacheSize = Long.valueOf(parsed.getProperty(OPENCAST_CACHE_SIZE,"10")) * 1024 * 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration set 50MB per default. We have to choose one, 10 or 50 but same default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have matched this line to the default value.
|
||
private int maxAge; | ||
|
||
public CacheInterceptor(int maxAge) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ducument the argument what int does mean here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment to explain the argument.
Response response = chain.proceed(chain.request()); | ||
|
||
CacheControl cacheControl = new CacheControl.Builder() | ||
.maxAge(this.maxAge, TimeUnit.MINUTES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does PT0M
work with this? Or do we need an edge case with CacheControl.Builder#noStore()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes PT0M does work with this.
81b2e9d
to
89ffa51
Compare
This PR fixes #15.
Details:
Instead of caching in the Reactive Stream layer we use the caching facilities of
OkHttpClient
. The behaviour differs from the former implementation in