Package: org.codehaus.groovy.runtime.memoize

## [Java] Class UnlimitedConcurrentCacheK, V

- org.codehaus.groovy.runtime.memoize.UnlimitedConcurrentCache

- All Implemented Interfaces and Traits:
    EvictableCache, Serializable

      @com.github.javaparser.ast.expr.MarkerAnnotationExprThreadSafe
      public final class UnlimitedConcurrentCache
      extends Object

  A cache backed by a ConcurrentHashMap

- - ### Constructor Summary

    Constructors
    Constructor and description
    `UnlimitedConcurrentCache ()` Constructs a cache with unlimited size
    `UnlimitedConcurrentCache (int initialCapacity)` Constructs a cache with unlimited size and set its initial capacity
    `UnlimitedConcurrentCache (Map<? extends K, ? extends V> m)` Constructs a cache and initialize the cache with the specified map

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `cleanUpNullReferences()` Replying on the ConcurrentHashMap thread-safe iteration implementation the method will remove all entries holding SoftReferences to gc-evicted objects.
    `` | `Map<K, V>` | `clearAll()` Clear the cache
    `` | `boolean` | `containsKey(Object key)` Determines if the cache contains an entry for the specified key.
    `` | `boolean` | `containsValue(Object value)`
    `` | `Set<Entry<K, V>>` | `entrySet()`
    `` | `V` | `get(Object key)` Gets a value from the cache
    `` | `V` | `getAndPut(K key, ValueProvider<? super K, ? extends V> valueProvider)` Try to get the value from cache.
    `` | `boolean` | `isEmpty()`
    `` | `Set<K>` | `keySet()`
    `` | `Set<K>` | `keys()` Get all keys associated to cached values
    `` | `V` | `put(K key, V value)` Associates the specified value with the specified key in the cache.
    `` | `void` | `putAll(Map<? extends K, ? extends V> m)`
    `` | `V` | `remove(Object key)` Remove the cached value by the key
    `` | `int` | `size()` Get the size of the cache
    `` | `Collection<V>` | `values()` Get all cached values

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### public UnlimitedConcurrentCache()

      Constructs a cache with unlimited size

    - #### public UnlimitedConcurrentCache(int initialCapacity)

      Constructs a cache with unlimited size and set its initial capacity

      Parameters:
        `initialCapacity` - the initial capacity

    - #### public UnlimitedConcurrentCache(Map<? extends K, ? extends V> m)

      Constructs a cache and initialize the cache with the specified map

      Parameters:
        `m` - the map to initialize the cache

  - ### Method Detail

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void cleanUpNullReferences()

      Replying on the ConcurrentHashMap thread-safe iteration implementation the method will remove all entries holding SoftReferences to gc-evicted objects.

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public Map<K, V> clearAll()

      Clear the cache

      Returns:
        returns the content of the cleared map

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public boolean containsKey(Object key)

      Determines if the cache contains an entry for the specified key.

      Parameters:
        `key` - key whose presence in this cache is to be tested.
      Returns:
        true if the cache contains a mapping for the specified key

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public boolean containsValue(Object value)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public Set<Entry<K, V>> entrySet()

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public V get(Object key)

      Gets a value from the cache

      Parameters:
        `key` - the key whose associated value is to be returned
      Returns:
        the value, or null, if it does not exist.

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public V getAndPut(K key, ValueProvider<? super K, ? extends V> valueProvider)

      Try to get the value from cache. If not found, create the value by MemoizeCache.ValueProvider and put it into the cache, at last return the value.

      Parameters:
        key
        `valueProvider` - provide the value if the associated value not found
      Returns:
        the cached value

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public boolean isEmpty()

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public Set<K> keySet()

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public Set<K> keys()

      Get all keys associated to cached values

      Returns:
        all keys

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public V put(K key, V value)

      Associates the specified value with the specified key in the cache.

      Parameters:
        `key` - key with which the specified value is to be associated
        `value` - value to be associated with the specified key
      Returns:
        null, or the old value if the key associated with the specified key.

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public void putAll(Map<? extends K, ? extends V> m)

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public V remove(Object key)

      Remove the cached value by the key

      Parameters:
        key
      Returns:
        returns the removed value

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public int size()

      Get the size of the cache

      Returns:
        the size of the cache

    - #### @com.github.javaparser.ast.expr.MarkerAnnotationExprOverride public Collection<V> values()

      Get all cached values

      Returns:
        all cached values