Package: org.codehaus.groovy.runtime.memoize

## [Java] Interface EvictableCache<K, V>

- org.codehaus.groovy.runtime.memoize.MemoizeCache

- All Superinterfaces:
    MemoizeCache

  Represents an evictable memoize cache with its essential methods

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

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `enum` | `EvictableCache.EvictionStrategy` | Represents a eviction strategy for the cache with limited size

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Map<K, V>` | `clearAll()` Clear the cache
    `` | `boolean` | `containsKey(Object key)` Determines if the cache contains an entry for the specified key.
    `` | `Set<K>` | `keys()` Get all keys associated to cached values
    `` | `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
    --- | ---
    `interface MemoizeCache` | `cleanUpNullReferences, get, getAndPut, put`
    `interface Map` | `remove, remove, get, put, equals, values, hashCode, clear, isEmpty, replace, replace, replaceAll, size, entrySet, putAll, putIfAbsent, forEach, keySet, containsValue, containsKey, getOrDefault, computeIfAbsent, computeIfPresent, compute, merge`

- - ### Method Detail

    - #### public Map<K, V> clearAll()

      Clear the cache

      Returns:
        returns the content of the cleared map

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

    - #### public Set<K> keys()

      Get all keys associated to cached values

      Returns:
        all keys

    - #### public V remove(Object key)

      Remove the cached value by the key

      Parameters:
        `key` - of the cached value
      Returns:
        returns the removed value

    - #### public int size()

      Get the size of the cache

      Returns:
        the size of the cache

    - #### public Collection<V> values()

      Get all cached values

      Returns:
        all cached values