Class LRUCache<K,V> 
java.lang.Object
org.codehaus.groovy.runtime.memoize.LRUCache<K,V> 
- All Implemented Interfaces:
- MemoizeCache<K,- V> 
A cache backed by a ConcurrentLinkedHashMap
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.codehaus.groovy.runtime.memoize.MemoizeCacheMemoizeCache.ValueProvider<K,V> 
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidRemove all entries holding SoftReferences to gc-evicted objects.Gets a value from the cachegetAndPut(K key, MemoizeCache.ValueProvider<? super K, ? extends V> valueProvider) Try to get the value from cache.Associates the specified value with the specified key in the cache.
- 
Constructor Details- 
LRUCachepublic LRUCache(int maxCacheSize) 
 
- 
- 
Method Details- 
putDescription copied from interface:MemoizeCacheAssociates the specified value with the specified key in the cache.- Specified by:
- putin interface- MemoizeCache<K,- V> 
- Parameters:
- key- key with which the specified value is to be associated
- value- value to be associated with the specified key
- Returns:
- null, or the old value if the key associated with the specified key.
 
- 
getDescription copied from interface:MemoizeCacheGets a value from the cache- Specified by:
- getin interface- MemoizeCache<K,- V> 
- Parameters:
- key- the key whose associated value is to be returned
- Returns:
- the value, or null, if it does not exist.
 
- 
getAndPutTry to get the value from cache. If not found, create the value byMemoizeCache.ValueProviderand put it into the cache, at last return the value. The operation is completed atomically.- Specified by:
- getAndPutin interface- MemoizeCache<K,- V> 
- Parameters:
- key-
- valueProvider- provide the value if the associated value not found
- Returns:
- the cached value
 
- 
cleanUpNullReferencespublic void cleanUpNullReferences()Remove all entries holding SoftReferences to gc-evicted objects.- Specified by:
- cleanUpNullReferencesin interface- MemoizeCache<K,- V> 
 
 
-