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:
Shawn O. Pearce
2012-02-01 14:47:30 -08:00
parent 07a85820a6
commit 1dd862521f
7 changed files with 18 additions and 48 deletions

View File

@@ -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);
}

View File

@@ -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;
}
}

View File

@@ -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);
}