org.ehcache.core
Interface Jsr107Cache<K,V>

Type Parameters:
K - the key type
V - the value type

public interface Jsr107Cache<K,V>

Bridge interface for enabling specific JSR-107 methods not available on Cache.

Ehcache users should not have to depend on this type but rely exclusively on the api types in package javax.cache.


Method Summary
 V compute(K key, BiFunction<? super K,? super V,? extends V> computeFunction, NullaryFunction<java.lang.Boolean> replaceEqual, NullaryFunction<java.lang.Boolean> invokeWriter, NullaryFunction<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.
 void loadAll(java.util.Set<? extends K> keys, boolean replaceExistingValues, 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.
 

Method Detail

getAll

java.util.Map<K,V> getAll(java.util.Set<? extends K> keys)
Get all mappings for the provided set of keys

Parameters:
keys - the keys to retrieve
Returns:
a map containing the mappings

getAndRemove

V getAndRemove(K key)
Gets a value and removes it from this cache.

Parameters:
key - the key to lookup
Returns:
the associated value if any, null otherwise

getAndPut

V getAndPut(K key,
            V value)
Gets the previous value associated with the key and replaces the mapping using the provided value.

Parameters:
key - tje key to lookup
value - the new value
Returns:
the value previously associated if any, null otherwise

remove

boolean remove(K key)
Removes the mapping associated with the provided key.

Parameters:
key - the key to lookup
Returns:
true if a mapping was removed, false otherwise

removeAll

void removeAll()
Removes all mapping from this cache.


compute

V compute(K key,
          BiFunction<? super K,? super V,? extends V> computeFunction,
          NullaryFunction<java.lang.Boolean> replaceEqual,
          NullaryFunction<java.lang.Boolean> invokeWriter,
          NullaryFunction<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.

Parameters:
key - the key to lookup
computeFunction - the function potentially mutating the mapping
replaceEqual - should equal value be replaced
invokeWriter - should the writer be invoked
withStatsAndEvents - should statistics be updated and events fired
Returns:
the new value mapped to key

loadAll

void loadAll(java.util.Set<? extends K> keys,
             boolean replaceExistingValues,
             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.

Parameters:
keys - the keys to laod value for
replaceExistingValues - whether to update cache mappings
function - the function performing the loading