[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 a 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, merge, entrySet, putAll, entry, putIfAbsent, compute, of, of, of, of, of, of, of, of, of, of, of, forEach, containsKey, computeIfAbsent, containsValue, keySet, getOrDefault, computeIfPresent, ofEntries

Method Detail

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

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

© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/runtime/memoize/EvictableCache.html