RefreshCache boundary condition check.
@@ -75,6 +75,7 @@ public class RefreshCache<K, V> extends LoadingCache<K, V> {
}
private void addTaskOrUpdateLastAccessTime(Object taskId, long refreshMillis, K key) {
+ if (refreshMillis > 0) {
RefreshTask refreshTask = taskMap.computeIfAbsent(taskId, tid -> {
RefreshTask task = new RefreshTask(taskId, key);
task.lastAccessTime = System.currentTimeMillis();
@@ -85,6 +86,7 @@ public class RefreshCache<K, V> extends LoadingCache<K, V> {
});
refreshTask.lastAccessTime = System.currentTimeMillis();
}
+ }
@Override
public CacheGetResult<V> GET(K key) {
@@ -144,10 +146,12 @@ public class RefreshCache<K, V> extends LoadingCache<K, V> {
}
long now = System.currentTimeMillis();
long stopRefreshAfterLastAccessMillis = config.getRefreshPolicy().getStopRefreshAfterLastAccessMillis();
+ if (stopRefreshAfterLastAccessMillis > 0) {
if (lastAccessTime + stopRefreshAfterLastAccessMillis < now) {
cancel();
return;
}
+ }
Cache c = concreteCache();
if (c instanceof AbstractExternalCache) {
final byte[] suffix = "_#RL#".getBytes();
