Package: org.codehaus.groovy.runtime.memoize

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

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

- All Superinterfaces:
    MemoizeCache

      public interface EvictableCache<K, V>
      extends MemoizeCache, Map

  Represents an evictable memoize cache with its essential methods

  Type Parameters:
    `K` - type of the keys
    `V` - type of the values
  Since:
    2.5.0

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `interface` | `EvictableCache.Action` | Represents the action to deal with the cache
    `enum` | `EvictableCache.EvictionStrategy` | Represents an eviction strategy for the cache with limited size

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `clear()` Clear the cache
    `` | `public Map<K, V>` | `clearAll()` Clear the cache
    `` | `public boolean` | `containsKey(Object key)` Determines if the cache contains an entry for the specified key.
    `` | `public Set<K>` | `keys()` Get all keys associated to cached values
    `` | `public V` | `remove(Object key)` Remove the cached value by the key
    `` | `public int` | `size()` Get the size of the cache
    `` | `public 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, copyOf, clear, isEmpty, replace, replace, replaceAll, size, of, of, of, of, of, of, of, of, of, of, of, merge, entrySet, putAll, putIfAbsent, compute, entry, forEach, containsKey, computeIfAbsent, keySet, containsValue, getOrDefault, computeIfPresent, ofEntries`

- - ### Method Detail

    - #### @Override
      public void clear()

      Clear the cache

      See Also:
        clearAll()

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

      Clear the cache

      Returns:
        returns the content of the cleared map

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

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

      Remove the cached value by the key

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

    - #### @Override
      public int size()

      Get the size of the cache

      Returns:
        the size of the cache

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

      Get all cached values

      Returns:
        all cached values