K
- key typeV
- real value typepublic class ConcurrentSoftCache<K,V> extends ConcurrentCommonCache<K,SoftReference<V>>
ConcurrentCommonCache.Action<K,V,R>
EvictableCache.EvictionStrategy
MemoizeCache.ValueProvider<K,V>
Constructor and Description |
---|
ConcurrentSoftCache()
Constructs a cache with unlimited size
|
ConcurrentSoftCache(int maxSize)
Constructs a LRU cache with the default initial capacity(16)
|
ConcurrentSoftCache(int initialCapacity,
int maxSize)
Constructs a LRU cache with the specified initial capacity and max size.
|
ConcurrentSoftCache(int initialCapacity,
int maxSize,
EvictableCache.EvictionStrategy evictionStrategy)
Constructs a cache with limited size
|
ConcurrentSoftCache(Map<K,SoftReference<V>> map)
Constructs a cache backed by the specified
Map instance |
Modifier and Type | Method and Description |
---|---|
Object |
convertValue(SoftReference<V> value)
convert the original value to the target value
|
cleanUpNullReferences, clear, clearAll, containsKey, containsValue, entrySet, get, getAndPut, getAndPut, isEmpty, keys, keySet, put, putAll, remove, size, values
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public ConcurrentSoftCache()
public ConcurrentSoftCache(int initialCapacity, int maxSize, EvictableCache.EvictionStrategy evictionStrategy)
initialCapacity
- initial capacity of the cachemaxSize
- max size of the cacheevictionStrategy
- LRU or FIFO, see EvictableCache.EvictionStrategy
public ConcurrentSoftCache(int initialCapacity, int maxSize)
LRUCache
initialCapacity
- initial capacity of the LRU cachemaxSize
- max size of the LRU cachepublic ConcurrentSoftCache(int maxSize)
maxSize
- max size of the LRU cacheConcurrentSoftCache(int, int)
public Object convertValue(SoftReference<V> value)
convertValue
in interface ValueConvertable<SoftReference<V>,Object>
convertValue
in class ConcurrentCommonCache<K,SoftReference<V>>
value
- the original value