Package org.jboss.weld.util.cache
Interface ComputingCache<K,V>
-
public interface ComputingCache<K,V>A simple abstraction for computing cache. Implementations are not required to support recursive computations. A cache client must be aware that such computations may result in livelocks, inifinite loops and other undesired situations.- Author:
- Martin Kouba
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Remove all cache entries.voidforEachValue(Consumer<? super V> consumer)Performs the given action for each cached value.Iterable<V>getAllPresentValues()<T> TgetCastValue(Object key)VgetValue(K key)VgetValueIfPresent(K key)voidinvalidate(Object key)Invalidate the entry with the given key.longsize()
-
-
-
Method Detail
-
getCastValue
<T> T getCastValue(Object key)
- Parameters:
key-- Returns:
- the cache value cast to the required type
-
getValueIfPresent
V getValueIfPresent(K key)
- Parameters:
key-- Returns:
- the cache value if present (i.e. no computation is performed)
-
size
long size()
- Returns:
- the size of the cache
-
clear
void clear()
Remove all cache entries.
-
invalidate
void invalidate(Object key)
Invalidate the entry with the given key. No-op if no such entry exists.- Parameters:
key-
-
-