Remove Cache.getTimeToLive method
Not all caches have a time to live property, a cache that never evicts its elements doesn't have this concept. The only user in Gerrit is the web session logic, so move this into that code path. Change-Id: I74cb488764bea10cde9d6eb60824585268f6be34
This commit is contained in:
@@ -14,9 +14,6 @@
|
||||
|
||||
package com.google.gerrit.server.cache;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* A fast in-memory and/or on-disk based cache.
|
||||
*
|
||||
@@ -35,12 +32,4 @@ public interface Cache<K, V> {
|
||||
|
||||
/** Remove all cached items. */
|
||||
public void removeAll();
|
||||
|
||||
/**
|
||||
* Get the time an element will survive in the cache.
|
||||
*
|
||||
* @param unit desired units of the return value.
|
||||
* @return time an item can live before being purged.
|
||||
*/
|
||||
public long getTimeToLive(TimeUnit unit);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.cache;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* An infinitely sized cache backed by java.util.ConcurrentHashMap.
|
||||
@@ -46,9 +45,4 @@ public class ConcurrentHashMapCache<K, V> implements Cache<K, V> {
|
||||
public void removeAll() {
|
||||
map.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimeToLive(TimeUnit unit) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
package com.google.gerrit.server.cache;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/** Proxy around a cache which has not yet been created. */
|
||||
public final class ProxyCache<K, V> implements Cache<K, V> {
|
||||
private volatile Cache<K, V> self;
|
||||
@@ -28,10 +26,6 @@ public final class ProxyCache<K, V> implements Cache<K, V> {
|
||||
return self.get(key);
|
||||
}
|
||||
|
||||
public long getTimeToLive(TimeUnit unit) {
|
||||
return self.getTimeToLive(unit);
|
||||
}
|
||||
|
||||
public void put(K key, V value) {
|
||||
self.put(key, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user