K
- the key typeV
- the value typepublic interface Jsr107Cache<K,V>
Cache
.
Ehcache
users should not have to depend on this type but rely exclusively on the api types in package
javax.cache
.
Modifier and Type | Method and Description |
---|---|
void |
compute(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> computeFunction,
java.util.function.Supplier<java.lang.Boolean> replaceEqual,
java.util.function.Supplier<java.lang.Boolean> invokeWriter,
java.util.function.Supplier<java.lang.Boolean> withStatsAndEvents)
Invokes the
computeFunction passing in the current mapping for key and using the others functions
to specify some behaviours of the operation. |
java.util.Map<K,V> |
getAll(java.util.Set<? extends K> keys)
Get all mappings for the provided set of keys
|
V |
getAndPut(K key,
V value)
Gets the previous value associated with the key and replaces the mapping using the provided value.
|
V |
getAndRemove(K key)
Gets a value and removes it from this cache.
|
V |
getNoLoader(K key)
Perform a cache get that does not make use of any configured loader
|
void |
loadAll(java.util.Set<? extends K> keys,
boolean replaceExistingValues,
java.util.function.Function<java.lang.Iterable<? extends K>,java.util.Map<K,V>> function)
Invokes the cache loader for the given keys, optionally replacing the cache mappings with the loaded values.
|
boolean |
remove(K key)
Removes the mapping associated with the provided key.
|
void |
removeAll()
Removes all mapping from this cache.
|
java.util.Iterator<Cache.Entry<K,V>> |
specIterator()
Return an iterator that follows the JSR 107 spec.
|
java.util.Map<K,V> getAll(java.util.Set<? extends K> keys)
keys
- the keys to retrieveV getAndRemove(K key)
key
- the key to lookupnull
otherwiseV getAndPut(K key, V value)
key
- tje key to lookupvalue
- the new valuenull
otherwiseboolean remove(K key)
key
- the key to lookuptrue
if a mapping was removed, false
otherwisevoid removeAll()
void compute(K key, java.util.function.BiFunction<? super K,? super V,? extends V> computeFunction, java.util.function.Supplier<java.lang.Boolean> replaceEqual, java.util.function.Supplier<java.lang.Boolean> invokeWriter, java.util.function.Supplier<java.lang.Boolean> withStatsAndEvents)
computeFunction
passing in the current mapping for key
and using the others functions
to specify some behaviours of the operation.key
- the key to lookupcomputeFunction
- the function potentially mutating the mappingreplaceEqual
- should equal value be replacedinvokeWriter
- should the writer be invokedwithStatsAndEvents
- should statistics be updated and events firedvoid loadAll(java.util.Set<? extends K> keys, boolean replaceExistingValues, java.util.function.Function<java.lang.Iterable<? extends K>,java.util.Map<K,V>> function)
keys
- the keys to laod value forreplaceExistingValues
- whether to update cache mappingsfunction
- the function performing the loadingjava.util.Iterator<Cache.Entry<K,V>> specIterator()