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 void
clear()
Remove all cache entries.void
forEachValue(Consumer<? super V> consumer)
Performs the given action for each cached value.Iterable<V>
getAllPresentValues()
<T> T
getCastValue(Object key)
V
getValue(K key)
V
getValueIfPresent(K key)
void
invalidate(Object key)
Invalidate the entry with the given key.long
size()
-
-
-
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
-
-
-