public static class Caches.ClearableCache<K,V>
extends java.lang.Object
The set of keys that are tracked are only those provided to peek(K) and computeIfAbsent(K, java.util.function.Function<K, V>).
Cache.Shrinkable<V>| Constructor and Description |
|---|
ClearableCache(Cache<K,V> cache) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all tracked keys from the cache.
|
V |
computeIfAbsent(K key,
java.util.function.Function<K,V> loadingFunction)
Looks up the specified key and returns the associated value.
|
void |
put(K key,
V value)
Inserts a new value associated with the given key or updates an existing association of the
same key with the new value.
|
void |
remove(K key)
Removes the mapping for a key from the cache if it is present.
|
public V computeIfAbsent(K key, java.util.function.Function<K,V> loadingFunction)
CacheIf the key is not present in the cache, the specified function will be used to load and populate the cache.
computeIfAbsent in interface Cache<K,V>public void put(K key, V value)
Cachepublic void remove(K key)
Cachepublic void clear()