@ThreadSafe public final class LRUCache<K,V> extends Object implements MemoizeCache<K,V>
MemoizeCache.ValueProvider<K,V>
Constructor and Description |
---|
LRUCache(int maxCacheSize) |
Modifier and Type | Method and Description |
---|---|
void |
cleanUpNullReferences()
Remove all entries holding SoftReferences to gc-evicted objects.
|
V |
get(K key)
Gets a value from the cache
|
V |
getAndPut(K key,
MemoizeCache.ValueProvider<? super K,? extends V> valueProvider)
The implementation of `getAndPut` is not atomic
|
V |
put(K key,
V value)
Associates the specified value with the specified key in the cache.
|
public V put(K key, V value)
MemoizeCache
put
in interface MemoizeCache<K,V>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keypublic V get(K key)
MemoizeCache
get
in interface MemoizeCache<K,V>
key
- the key whose associated value is to be returnedpublic V getAndPut(K key, MemoizeCache.ValueProvider<? super K,? extends V> valueProvider)
getAndPut
in interface MemoizeCache<K,V>
public void cleanUpNullReferences()
cleanUpNullReferences
in interface MemoizeCache<K,V>