org.eclipse.internal.xtend.util
Class WeakCache2<K,V>
java.lang.Object
org.eclipse.internal.xtend.util.WeakCache2<K,V>
- Type Parameters:
K
- Key typeV
- Value type
public class WeakCache2<K,V>
- extends java.lang.Object
A cache implementation based on WeakReferences which cleans up GCed references regularely. Originally copied from
URI
' internal URICache class.
Field Summary |
protected java.util.Map<K,java.lang.ref.WeakReference<V>> |
map
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
map
protected java.util.Map<K,java.lang.ref.WeakReference<V>> map
WeakCache2
public WeakCache2()
WeakCache2
public WeakCache2(int min_limit)
get
public V get(K key)
put
public void put(K key,
V value)
containsKey
public boolean containsKey(java.lang.String key)
- Parameters:
key
- Cache key
- Returns:
true
if the cache contains an element with the given key.
getTotalCount
public long getTotalCount()
- Returns:
- the totalCount
getHitCount
public long getHitCount()
- Returns:
- the hitCount
getMissCount
public long getMissCount()
getHitRatio
public double getHitRatio()