public interface KeyValueStore<K,V> extends AdvancedKeyValueSource<K,V>
This interface contains no methods that expose or mutate the cache state. This is intended as a reduced interface that has transparent semantics in cache through operation.
Modifier and Type | Method and Description |
---|---|
void |
put(K key,
V value)
Insert or update a value associated with the given key.
|
void |
putAll(Map<? extends K,? extends V> valueMap)
Insert or update all elements of the map into the cache.
|
void |
remove(K key)
Remove a value from the cache that is associated with the key.
|
void |
removeAll(Iterable<? extends K> keys)
Remove mappings from the cache.
|
getAll, prefetch, prefetchAll
get
void put(K key, V value)
key
- key with which the specified value is associatedvalue
- value to be associated with the specified keyCache.put(Object, Object)
void putAll(Map<? extends K,? extends V> valueMap)
valueMap
- Map of keys with associated values to be inserted in the cacheNullPointerException
- if one of the specified keys is nullvoid remove(K key)
Rationale: It is intentional that this method does not return
a boolean or the previous entry. When operating in cache through
configuration (which means CacheWriter
CacheLoader
is registered) a boolean
could mean two different things: the value was present in the cache or
the value was present in the system of authority. The purpose of this
interface is a reduced set of methods that cannot be misinterpreted.
key
- key which mapping is to be removed from the cache, not nullCache.remove(K)
void removeAll(Iterable<? extends K> keys)
keys
- keys is to be removed from the cacheCache.removeAll(java.lang.Iterable<? extends K>)
cache2k API documentation. Copyright © 2000–2017 headissue GmbH, Munich.