public class ExpiringMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
限定符和类型 | 类和说明 |
---|---|
class |
ExpiringMap.Expirer
A Thread that monitors an
ExpiringMap and will remove
elements that have passed the threshold. |
限定符和类型 | 字段和说明 |
---|---|
static int |
DEFAULT_EXPIRATION_INTERVAL
The default value, 1 second
|
static int |
DEFAULT_TIME_TO_LIVE
The default value, 60 seconds
|
构造器和说明 |
---|
ExpiringMap()
Creates a new instance of ExpiringMap using the default values
DEFAULT_TIME_TO_LIVE and DEFAULT_EXPIRATION_INTERVAL
|
ExpiringMap(int timeToLive)
Creates a new instance of ExpiringMap using the supplied
time-to-live value and the default value for DEFAULT_EXPIRATION_INTERVAL
|
ExpiringMap(int timeToLive,
int expirationInterval)
Creates a new instance of ExpiringMap using the supplied values and
a
ConcurrentHashMap for the internal data structure. |
限定符和类型 | 方法和说明 |
---|---|
void |
addExpirationListener(ExpirationListener<V> listener) |
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object obj) |
V |
get(java.lang.Object key) |
int |
getExpirationInterval() |
ExpiringMap.Expirer |
getExpirer() |
int |
getTimeToLive() |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> inMap) |
V |
remove(java.lang.Object key) |
void |
removeExpirationListener(ExpirationListener<V> listener) |
void |
setExpirationInterval(int expirationInterval) |
void |
setTimeToLive(int timeToLive) |
int |
size() |
java.util.Collection<V> |
values() |
public static final int DEFAULT_TIME_TO_LIVE
public static final int DEFAULT_EXPIRATION_INTERVAL
public ExpiringMap()
public ExpiringMap(int timeToLive)
timeToLive
- The time-to-live value (seconds)public ExpiringMap(int timeToLive, int expirationInterval)
ConcurrentHashMap
for the internal data structure.timeToLive
- The time-to-live value (seconds)expirationInterval
- The time between checks to see if a value should be removed (seconds)public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public int hashCode()
public boolean equals(java.lang.Object obj)
public void addExpirationListener(ExpirationListener<V> listener)
public void removeExpirationListener(ExpirationListener<V> listener)
public ExpiringMap.Expirer getExpirer()
public int getExpirationInterval()
public int getTimeToLive()
public void setExpirationInterval(int expirationInterval)
public void setTimeToLive(int timeToLive)