public class TimedHashMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
Constructor and Description |
---|
TimedHashMap() |
TimedHashMap(long timeout,
java.util.concurrent.TimeUnit unit)
Create a new map with a non-default entry timeout period
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key)
Return cached item if it has not already expired.
|
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
put(K key,
V value)
Store the item in the map and associate a timestamp with it.
|
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
remove(java.lang.Object key) |
void |
setTimeout(long timeout,
java.util.concurrent.TimeUnit unit)
Specify how long (in nanoseconds) entries are valid for
|
int |
size() |
java.util.Collection<V> |
values() |
public TimedHashMap()
public TimedHashMap(long timeout, java.util.concurrent.TimeUnit unit)
unit
- the units of the timeouttimeout
- the length of the timeoutpublic void setTimeout(long timeout, java.util.concurrent.TimeUnit unit)
unit
- the units of the timeouttimeout
- the length of the timeoutpublic V put(K key, V value)
public V get(java.lang.Object key)
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)