K
- key typeV
- real value typepublic class ConcurrentSoftCache<K,V> extends ConcurrentCommonCache<K,java.lang.ref.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(java.util.Map<K,java.lang.ref.SoftReference<V>> map)
Constructs a cache backed by the specified
Map instance |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
convertValue(java.lang.ref.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
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 java.lang.Object convertValue(java.lang.ref.SoftReference<V> value)
convertValue
in interface ValueConvertable<java.lang.ref.SoftReference<V>,java.lang.Object>
convertValue
in class ConcurrentCommonCache<K,java.lang.ref.SoftReference<V>>
value
- the original value