fabric.common.util
Class Cache<K,V>
java.lang.Object
fabric.common.util.Cache<K,V>
public class Cache<K,V>
- extends java.lang.Object
A thread-safe map with soft references to its values. When a value in the map
is garbage collected by the JVM, its corresponding key is removed from the
map.
Constructor Summary |
Cache()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Cache
public Cache()
clear
public void clear()
containsKey
public boolean containsKey(K key)
get
public V get(K key)
put
public V put(K key,
V value)
remove
public V remove(java.lang.Object key)
keys
public java.util.Set<K> keys()
- Returns a snapshot of the keys currently in the cache. This set is NOT
backed by the underlying map. If new keys are inserted or removed from the
cache, they will not be reflected by the set returned. However, no
synchronization is needed for working with the set.