|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<K,V> java.util.HashMap<K,V> jgroup.util.CacheMap<K,V>
public class CacheMap<K,V>
Implementation of a map with limited access times to a key/value pair. When an entry is inserted in the map, you must specify the number of times the entry can be retrieved before it is inaccessible/removed.
This map can be useful when caching objects, and you need a way to remove old items from the cache.
Constructor Summary | |
---|---|
CacheMap()
|
Method Summary | |
---|---|
void |
clear()
Clear the map. |
V |
get(java.lang.Object key)
Returns the value of the given key, if key is accessible. |
V |
put(K key,
V value)
|
void |
put(K key,
V value,
int maxAccesses)
Insert a key/value in a HashMap , and set the number of
times it can be accessed. |
void |
putAll(java.util.Map<? extends K,? extends V> m)
|
int |
size()
Returns the size of cache map |
java.lang.String |
toString()
|
Methods inherited from class java.util.HashMap |
---|
clone, containsKey, containsValue, entrySet, isEmpty, keySet, remove, values |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public CacheMap()
Method Detail |
---|
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
get
in class java.util.HashMap<K,V>
public void put(K key, V value, int maxAccesses)
HashMap
, and set the number of
times it can be accessed.
public V put(K key, V value)
put
in interface java.util.Map<K,V>
put
in class java.util.HashMap<K,V>
public void putAll(java.util.Map<? extends K,? extends V> m)
putAll
in interface java.util.Map<K,V>
putAll
in class java.util.HashMap<K,V>
public void clear()
clear
in interface java.util.Map<K,V>
clear
in class java.util.HashMap<K,V>
public int size()
size
in interface java.util.Map<K,V>
size
in class java.util.HashMap<K,V>
public java.lang.String toString()
toString
in class java.util.AbstractMap<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |