Top Description Inners Methods
org.codehaus.groovy.runtime.memoize

public Interface EvictableCache<K, V>

extends MemoizeCache<K, V>, Map<K, V>
Known Direct Implementers
org.codehaus.groovy.runtime.memoize.StampedCommonCache, org.codehaus.groovy.runtime.memoize.UnlimitedConcurrentCache, org.codehaus.groovy.runtime.memoize.CommonCache, org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache
Type Parameters
<K>
type of the keys
<V>
type of the values
Imports
java.util.Collection, .Map, .Set

Represents an evictable memoize cache with its essential methods
Since
2.5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
EvictableCache.Action<
key type
K
,
value type
V
,
result type
R
>

Represents the action to deal with the cache

public static enum
EvictableCache.EvictionStrategy

Represents a eviction strategy for the cache with limited size

Method Summary

Modifier and TypeMethod and Description
public default void
clear()

Implements java.util.Map.clear.

Clear the cache
public Map<K, V>

Returns:

returns the content of the cleared map
clearAll
()

Clear the cache

public boolean

Returns:

true if the cache contains a mapping for the specified key
containsKey
(Object
key whose presence in this cache is to be tested.
key
)

Redeclares java.util.Map.containsKey.

Determines if the cache contains an entry for the specified key.
public Set<K>

Returns:

all keys
keys
()

Get all keys associated to cached values

public V

Returns:

returns the removed value
remove
(Object
of the cached value
key
)

Redeclares java.util.Map.remove.

Remove the cached value by the key
public int

Returns:

the size of the cache
size
()

Redeclares java.util.Map.size.

Get the size of the cache
public Collection<V>

Returns:

all cached values
values
()

Redeclares java.util.Map.values.

Get all cached values
Inherited from java.util.Map:
computecomputeIfAbsentcomputeIfPresentcontainsValuecopyOfentryentrySetequalsforEachgetgetOrDefaulthashCodeisEmptykeySetmergeofofofofofofofofofofofofEntriesputputAllputIfAbsentremovereplacereplacereplaceAll
Inherited from org.codehaus.groovy.runtime.memoize.MemoizeCache:
cleanUpNullReferencesgetgetAndPutput

Method Detail

clearback to summary
public default void clear()

Implements java.util.Map.clear.

Clear the cache

See Also
clearAll()
clearAllback to summary
public Map<K, V> clearAll()

Clear the cache

Returns:Map<K, V>

returns the content of the cleared map

containsKeyback to summary
public boolean containsKey(Object key)

Redeclares java.util.Map.containsKey.

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

Parameters
key:Object

key whose presence in this cache is to be tested.

Returns:boolean

true if the cache contains a mapping for the specified key

keysback to summary
public Set<K> keys()

Get all keys associated to cached values

Returns:Set<K>

all keys

removeback to summary
public V remove(Object key)

Redeclares java.util.Map.remove.

Remove the cached value by the key

Parameters
key:Object

of the cached value

Returns:V

returns the removed value

sizeback to summary
public int size()

Redeclares java.util.Map.size.

Get the size of the cache

Returns:int

the size of the cache

valuesback to summary
public Collection<V> values()

Redeclares java.util.Map.values.

Get all cached values

Returns:Collection<V>

all cached values

org.codehaus.groovy.runtime.memoize back to summary

public Interface EvictableCache.Action<K, V, R>

Annotations
@FunctionalInterface
Type Parameters
<K>
key type
<V>
value type
<R>
result type

Represents the action to deal with the cache
Since
3.0.0

Method Summary

Modifier and TypeMethod and Description
public R
doWith(EvictableCache<K, V> evictableCache)

Deal with the cache

Method Detail

doWithback to summary
public R doWith(EvictableCache<K, V> evictableCache)

Deal with the cache

org.codehaus.groovy.runtime.memoize back to summary

public final Enum EvictableCache.EvictionStrategy

extends Enum<EvictableCache.EvictionStrategy>
Class Inheritance

Represents a eviction strategy for the cache with limited size

Field Summary

Modifier and TypeField and Description
public static final EvictableCache.EvictionStrategy
FIFO

Entries are evicted in the same order as they come in

public static final EvictableCache.EvictionStrategy
LRU

The oldest entry(i.e. the Less Recently Used entry) will be evicted

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static EvictableCache.EvictionStrategy
public static EvictableCache.EvictionStrategy[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FIFOback to summary
public static final EvictableCache.EvictionStrategy FIFO

Entries are evicted in the same order as they come in

LRUback to summary
public static final EvictableCache.EvictionStrategy LRU

The oldest entry(i.e. the Less Recently Used entry) will be evicted

Constructor Detail

EvictionStrategyback to summary
private EvictionStrategy()

Method Detail

valueOfback to summary
public static EvictableCache.EvictionStrategy valueOf(String name)
valuesback to summary
public static EvictableCache.EvictionStrategy[] values()