public class ExpiryCache<K>
extends java.lang.Object
AgeOutCache
,
ExpiryCache doesn't require a timer task to run限定符和类型 | 字段和说明 |
---|---|
protected java.util.concurrent.ConcurrentMap<K,java.lang.Long> |
map |
protected long |
timeout |
构造器和说明 |
---|
ExpiryCache(long timeout)
Creates a new instance
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
addIfAbsentOrExpired(K key) |
void |
clear() |
boolean |
contains(K key) |
long |
getTimeout() |
boolean |
hasExpired(K key) |
protected static boolean |
hasExpired(long val) |
void |
remove(K key) |
void |
removeAll(java.util.Collection<K> keys) |
int |
removeExpiredElements() |
void |
setTimeout(long timeout) |
int |
size() |
java.lang.String |
toString() |
protected long timeout
protected final java.util.concurrent.ConcurrentMap<K,java.lang.Long> map
public ExpiryCache(long timeout)
timeout
- Timeout in mspublic long getTimeout()
public void setTimeout(long timeout)
public boolean addIfAbsentOrExpired(K key)
public boolean contains(K key)
public boolean hasExpired(K key)
public void remove(K key)
public void removeAll(java.util.Collection<K> keys)
public int removeExpiredElements()
public void clear()
public int size()
public java.lang.String toString()
toString
在类中 java.lang.Object
protected static boolean hasExpired(long val)