ConcurrentSoftCache, SoftCachepublic interface Cache<K,V>
| Modifier and Type | Method | Description |
|---|---|---|
void |
evict(K key) |
Evicts the entry with the given key from this cache.
|
void |
evict(K key,
V value) |
Evicts the entry with the given key and value from this cache.
|
void |
evictAll() |
Evicts all entries from this cache.
|
void |
forEach(java.util.function.BiConsumer<? super K,? super V> action) |
Performs the given action for each entry in this cache until all entries have been processed or the action throws an exception.
|
java.util.Optional<V> |
get(K key) |
Returns the value associated with the given key in this cache.
|
V |
getOrDefault(K key,
V defaultValue) |
Returns the value associated with the given key in this cache.
|
boolean |
isEmpty() |
Checks whether this cache is empty.
|
void |
put(K key,
V value) |
Creates an entry with the given key and value in this cache.
|
void |
putIfAbsent(K key,
V value) |
Creates an entry with the given key and value in this cache only if no entry with the same key already exists.
|
int |
size() |
Returns the number of entries in this cache.
|
void evict(K key)
java.lang.IllegalArgumentException - if key is nullMap.remove(Object)void evict(K key, V value)
java.lang.IllegalArgumentException - if key is nulljava.lang.IllegalArgumentException - if value is nullMap.remove(Object, Object)void evictAll()
Map.clear()void forEach(java.util.function.BiConsumer<? super K,? super V> action)
java.lang.IllegalArgumentException - if action is nullMap.forEach(BiConsumer)java.util.Optional<V> get(K key)
java.lang.IllegalArgumentException - if key is nullMap.get(Object)V getOrDefault(K key, V defaultValue)
java.lang.IllegalArgumentException - if key is nullMap.getOrDefault(Object, Object)boolean isEmpty()
Map.isEmpty()void put(K key, V value)
java.lang.IllegalArgumentException - if key is nulljava.lang.IllegalArgumentException - if value is nullMap.put(Object, Object)void putIfAbsent(K key, V value)
java.lang.IllegalArgumentException - if key is nulljava.lang.IllegalArgumentException - if value is nullMap.putIfAbsent(Object, Object)int size()
Map.size()