Interface MemoizeCache<K,V>
- Type Parameters:
K- type of the keysV- type of the values
- All Known Subinterfaces:
EvictableCache<K,V>
- All Known Implementing Classes:
CommonCache, ConcurrentCommonCache, ConcurrentSoftCache, LRUCache, UnlimitedConcurrentCache
public interface MemoizeCache<K,V>
Represents a memoize cache with its essential methods
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a provider used to create value -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when some of the held SoftReferences have been evicted by the garbage collector and so should be removed from the cache.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.
-
Method Details
-
put
-
get
-
getAndPut
Try to get the value from cache. If not found, create the value byMemoizeCache.ValueProviderand put it into the cache, at last return the value- Parameters:
key-- Returns:
- the cached value
-
cleanUpNullReferences
void cleanUpNullReferences()Invoked when some of the held SoftReferences have been evicted by the garbage collector and so should be removed from the cache. The implementation must ensure that concurrent invocations of all methods on the cache may occur from other threads and thus should protect any shared resources.
-