[Java] Class ConcurrentSoftCache<K, V>
- org.codehaus.groovy.runtime.memoize.ConcurrentSoftCache
public class ConcurrentSoftCache<K, V> extends ConcurrentCommonCache
Represents concurrent cache holding SoftReference instance as value
- Type Parameters:
-
K- key type -
V- real value type
Constructor Summary
| Constructor and description |
|---|
ConcurrentSoftCache
()Constructs a cache with unlimited size |
ConcurrentSoftCache
(int initialCapacity, int maxSize, EvictionStrategy evictionStrategy)Constructs a cache with limited size |
ConcurrentSoftCache
(int initialCapacity, int maxSize)Constructs a LRU cache with the specified initial capacity and max size. |
ConcurrentSoftCache
(int maxSize)Constructs a LRU cache with the default initial capacity(16) |
ConcurrentSoftCache
(Map<K, SoftReference<V>> map)Constructs a cache backed by the specified Map instance |
Methods Summary
| Type Params | Return Type | Name and description |
|---|---|---|
public Object |
convertValue(SoftReference<V> value){@inheritDoc} |
Inherited Methods Summary
| Methods inherited from class | Name |
|---|---|
class ConcurrentCommonCache | cleanUpNullReferences, clearAll, containsKey, containsValue, convertValue, entrySet, get, getAndPut, getAndPut, isEmpty, keySet, keys, put, putAll, remove, size, values |
Constructor Detail
public ConcurrentSoftCache()
Constructs a cache with unlimited size
public ConcurrentSoftCache(int initialCapacity, int maxSize, EvictionStrategy evictionStrategy)
Constructs a cache with limited size
- Parameters:
-
initialCapacity- initial capacity of the cache -
maxSize- max size of the cache -
evictionStrategy- LRU or FIFO, see org.codehaus.groovy.runtime.memoize.EvictableCache.EvictionStrategy
public ConcurrentSoftCache(int initialCapacity, int maxSize)
Constructs a LRU cache with the specified initial capacity and max size. The LRU cache is slower than LRUCache
- Parameters:
-
initialCapacity- initial capacity of the LRU cache -
maxSize- max size of the LRU cache
public ConcurrentSoftCache(int maxSize)
Constructs a LRU cache with the default initial capacity(16)
- Parameters:
-
maxSize- max size of the LRU cache
- See Also:
- ConcurrentSoftCache(int, int)
public ConcurrentSoftCache(Map<K, SoftReference<V>> map)
Constructs a cache backed by the specified Map instance
- Parameters:
-
map- the Map instance
Method Detail
@Override public Object convertValue(SoftReference<V> value)
{@inheritDoc}
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/runtime/memoize/ConcurrentSoftCache.html