|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.CacheMap<K,V>
K - the key typeV - the value typepublic class CacheMap<K,V>
A map with values that are softly-referenced. An entry is removed if its associated value gets garbage-collected, or, if the cache was constructed with a timeout, and entry is removed (lazily) when the timeout expires for that entry. A timeout is typically used to have the implementation remove values that become stale after a certain period of time. The implementation ensures that a caller will not have access to stale entries (i.e., entries whose timeout has expired).
| Constructor Summary | |
|---|---|
CacheMap()
Creates an instance of this class. |
|
CacheMap(long entryTimeout)
Creates an instance of this class with the specified entryTimeout. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all associations from this map. |
boolean |
containsKey(K key)
Checks if the map contains the specified key. |
V |
get(K key)
Returns the value associated with given key, or null if the key
is not found. |
V |
put(K key,
V value)
Associates a value with given key, returning the value previously associated with key, or null if none is found. |
V |
remove(K key)
Removes the association for the given key, returning the value previously associated with the key, or null if the key is not
found. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheMap()
public CacheMap(long entryTimeout)
entryTimeout.
entryTimeout - an entry timeout, in milliseconds
IllegalArgumentException - if entryTimeout is negative| Method Detail |
|---|
public V put(K key,
V value)
null if none is found.
key - the keyvalue - the value
nullpublic boolean containsKey(K key)
key - the key
true if the map contains the key, else falsepublic V get(K key)
null if the key
is not found.
key - the key
nullpublic V remove(K key)
null if the key is not
found.
key - the key
nullpublic void clear()
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||