K - the key typeV - the value type@PublicApi
public interface LocalCacheOperations<K,V>
| Modifier and Type | Method and Description |
|---|---|
Optional<V> |
get(K key)
Returns a value that is associated with a specified key.
|
V |
get(K key,
Supplier<? extends V> supplier)
Returns a value that may be associated with a specified key.
|
Map<K,V> |
getBulk(Function<Set<K>,Map<K,V>> factory,
Iterable<K> keys)
Returns the values that are associated with the specified keys.
|
default Map<K,V> |
getBulk(Function<Set<K>,Map<K,V>> factory,
K... keys)
Returns the values that are associated with the specified keys.
|
void |
put(K key,
V value)
Unconditionally puts the value under the specified key.
|
Optional<V> |
putIfAbsent(K key,
V value)
Conditionally puts the value under the specified key, if no entry currently exists.
|
void |
remove(K key)
Removes the entries for the supplied key.
|
void |
removeAll()
Removes all the entries in the cache.
|
boolean |
removeIf(K key,
V value)
Conditionally removed an entry for a specified key, iff:
An entry already exists for the key
The current value matches the supplied value using
Object.equals(Object)
|
boolean |
replaceIf(K key,
V currentValue,
V newValue)
Conditionally replaces the value associated with a key, iff:
An entry already exists for the key
The current value matches the supplied currentValue using
Object.equals(Object)
|
Optional<V> get(K key)
key - the key to check.Optional which may contain the value associated with the key.V get(K key, Supplier<? extends V> supplier)
Notes:
key - the key uniquely identifying the value to be retrievedsupplier - used to generate the value, if one does not exist already for the key. The supplier may not
return null.default Map<K,V> getBulk(Function<Set<K>,Map<K,V>> factory, K... keys)
getBulk(Function, Iterable) passing factory and Arrays.asList(keys) as the parameters.factory - used to generate the values for the keys that do not have entries. The factory must return a
map containing only a non-null value for each supplied key. Extra keys are not allowed.keys - the keys to retrieveMap that is keyed on the keys specified. Each entry in the Map will have
the value associated with the key.getBulk(Function, Iterable)Map<K,V> getBulk(Function<Set<K>,Map<K,V>> factory, Iterable<K> keys)
Notes:
remove(Object) or removeIf(Object, Object). Caller beware.
factory - used to generate the values for the keys that do not have entries. The factory must return a
map containing only a non-null value for each supplied key. Extra keys are not allowed.keys - the keys to retrieveMap that is keyed on the keys specified. Each entry in the Map will have
the value associated with the key.void put(K key, V value)
key - the key to put the data undervalue - the value to associate with the key.Optional<V> putIfAbsent(K key, V value)
key - the key to put the data undervalue - the value to associate with the key.Optional.EMPTY is no entry previously existed, otherwise the Optional contains
the current value.boolean replaceIf(K key, V currentValue, V newValue)
Object.equals(Object)key - the key to replace data undercurrentValue - the current value to matchnewValue - the replacement valueboolean removeIf(K key, V value)
Object.equals(Object)key - the key of the entry to remove conditionallyvalue - the current value to matchvoid remove(K key)
key - the key of the entry to removevoid removeAll()
Copyright © 2016 Atlassian. All rights reserved.