K - Type of the values in this cachepublic class TimedCache<K>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.ConcurrentMap<K,java.lang.Long> |
cache |
private long |
timeoutInterval |
| Constructor and Description |
|---|
TimedCache(int capacity,
int timeToLive) |
| Modifier and Type | Method and Description |
|---|---|
long |
getTimeoutInterval() |
boolean |
update(K key)
Always try to update the cache and set the last-seen value for this key.
|
private final long timeoutInterval
private java.util.concurrent.ConcurrentMap<K,java.lang.Long> cache
public TimedCache(int capacity,
int timeToLive)
capacity - the maximum number of entries in the cache before the
oldest entry is evicted.timeToLive - specified in millisecondspublic long getTimeoutInterval()
public boolean update(K key)
key -