@@ -12,8 +12,9 @@ |
import com.jayway.jsonpath.ReadContext; |
import csip.utils.Client; |
import csip.Config; |
-import csip.utils.LRUCache; |
import csip.SessionLogger; |
+import csip.utils.TTLCache; |
+import java.util.concurrent.TimeUnit; |
import java.util.logging.Level; |
|
/** |
@@ -64,7 +65,8 @@ |
.addOptions(Option.SUPPRESS_EXCEPTIONS); |
|
// <url> -> <response> |
- static final LRUCache<String, ReadContext> cache = new LRUCache<>(EDIT_CACHE_SIZE); |
+ static final TTLCache<String, ReadContext> cache = new TTLCache<>() |
+ .withSize(EDIT_CACHE_SIZE); |
|
SessionLogger log; |
|
@@ -98,7 +100,8 @@ |
} |
resp = JsonPath.parse(r); |
synchronized (cache) { |
- cache.put(url, resp); |
+ long untilEoD = TTLCache.untilEndOfDay(); |
+ cache.put(url, resp, 30, TimeUnit.MINUTES, untilEoD); |
} |
if (log != null && log.isLoggable(Level.INFO)) { |
log.info("GET from Edit: " + url + ": " + resp); |