Package: org.codehaus.groovy.runtime.memoize

## [Java] Interface MemoizeCacheK, V

- Represents a memoize cache with its essential methods

  Parameters:
    `` - type of the keys
    `` - type of the values

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `interface` | `MemoizeCache.ValueProvider` | Represents a provider used to create value

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `cleanUpNullReferences()` Invoked when some of the held SoftReferences have been evicted by the garbage collector and so should be removed from the cache.
    `` | `V` | `get(K key)` Gets a value from the cache
    `` | `V` | `getAndPut(K key, ValueProvider<? super K, ? extends V> valueProvider)` Try to get the value from cache.
    `` | `V` | `put(K key, V value)` Associates the specified value with the specified key in the cache.

- - ### Method Detail

    - #### public void cleanUpNullReferences()

      Invoked when some of the held SoftReferences have been evicted by the garbage collector and so should be removed from the cache. The implementation must ensure that concurrent invocations of all methods on the cache may occur from other threads and thus should protect any shared resources.

    - #### public V get(K 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.

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

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