Package: org.codehaus.groovy.runtime.memoize

## [Java] Class ConcurrentSoftCache<K, V>

- org.codehaus.groovy.runtime.memoize.ConcurrentSoftCache

- Represents concurrent cache holding SoftReference instance as value

  Parameters:
    `` - key type
    `` - real value type

- - ### Constructor Summary

    Constructors
    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

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Object` | `convertValue(SoftReference<V> value)` {@inheritDoc}

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ConcurrentCommonCache` | `cleanUpNullReferences, clear, clearAll, containsKey, containsValue, convertValue, entrySet, get, getAndPut, getAndPut, isEmpty, keySet, keys, put, putAll, remove, size, values`
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### 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}