Cache OMDb resources for up to a month
This commit is contained in:
parent
9b7a6041cd
commit
1d91160521
|
@ -125,7 +125,7 @@ public class OMDbClient implements MovieIdentificationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object request(Map<String, Object> parameters) throws Exception {
|
public Object request(Map<String, Object> parameters) throws Exception {
|
||||||
Cache cache = Cache.getCache(getName(), CacheType.Weekly);
|
Cache cache = Cache.getCache(getName(), CacheType.Monthly);
|
||||||
String key = '?' + encodeParameters(parameters, true);
|
String key = '?' + encodeParameters(parameters, true);
|
||||||
|
|
||||||
return cache.json(key, s -> getResource(s)).fetch(withPermit(fetchIfModified(), r -> REQUEST_LIMIT.acquirePermit())).expire(Cache.ONE_WEEK).get();
|
return cache.json(key, s -> getResource(s)).fetch(withPermit(fetchIfModified(), r -> REQUEST_LIMIT.acquirePermit())).expire(Cache.ONE_WEEK).get();
|
||||||
|
|
Loading…
Reference in New Issue