Map<K,V>
public class ExpiringMap<K,V> extends Object implements Map<K,V>
Modifier and Type | Class | Description |
---|---|---|
class |
ExpiringMap.Expirer |
A Thread that monitors an
ExpiringMap and will remove
elements that have passed the threshold. |
Modifier and Type | Field | Description |
---|---|---|
static int |
DEFAULT_EXPIRATION_INTERVAL |
The default value, 1 second
|
static int |
DEFAULT_TIME_TO_LIVE |
The default value, 60 seconds
|
Constructor | Description |
---|---|
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. |
Modifier and Type | Method | Description |
---|---|---|
void |
addExpirationListener(ExpirationListener<V> listener) |
|
void |
clear() |
|
boolean |
containsKey(Object key) |
|
boolean |
containsValue(Object value) |
|
Set<Map.Entry<K,V>> |
entrySet() |
|
boolean |
equals(Object obj) |
|
V |
get(Object key) |
|
int |
getExpirationInterval() |
|
ExpiringMap.Expirer |
getExpirer() |
|
int |
getTimeToLive() |
|
int |
hashCode() |
|
boolean |
isEmpty() |
|
Set<K> |
keySet() |
|
V |
put(K key,
V value) |
|
void |
putAll(Map<? extends K,? extends V> inMap) |
|
V |
remove(Object key) |
|
void |
removeExpirationListener(ExpirationListener<V> listener) |
|
void |
setExpirationInterval(int expirationInterval) |
|
void |
setTimeToLive(int timeToLive) |
|
int |
size() |
|
Collection<V> |
values() |
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
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(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public int hashCode()
public boolean equals(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)
Copyright © 2004–2018 Apache MINA Project. All rights reserved.