K
- key typeV
- value typepublic interface CacheReactive<K,V>
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
clear()
This method empties the cache's contents, without notifying listeners or
CacheWriter s. |
reactor.core.publisher.Mono<Boolean> |
containsKey(K key)
This method returns a Boolean true/false value, depending on whether the
CacheReactive has a mapping for a key k such that key.equals(k). |
reactor.core.publisher.Mono<V> |
get(K key)
This method retrieves an entry from the cache.
|
reactor.core.publisher.Mono<Map<K,V>> |
getAll(Set<? extends K> keys)
This method accepts a set of requested keys and retrieves a collection of entries from the
CacheReactive , returning them as a Map of the associated values. |
reactor.core.publisher.Mono<V> |
getAndPut(K key,
V value)
This method places the given key and value in the cache.
|
reactor.core.publisher.Mono<V> |
getAndRemove(K key)
This method atomically removes the entry for a key only if it is currently mapped to some
value.
|
reactor.core.publisher.Mono<V> |
getAndReplace(K key,
V value)
This method atomically replaces a given key's value if and only if the key is currently
mapped to a value.
|
reactor.core.publisher.Mono<Void> |
put(K key,
V value)
This method places the given value V in the cache and associates it with the given key K.
|
reactor.core.publisher.Mono<Void> |
putAll(Map<? extends K,? extends V> map)
This method copies all of the entries from the given Map to the
CacheReactive . |
reactor.core.publisher.Mono<Boolean> |
putIfAbsent(K key,
V value)
This method places the given key and value in the cache atomically, if the key is
not already associated with a value in the cache.
|
reactor.core.publisher.Mono<Boolean> |
remove(K key)
This method deletes the mapping for a given key from the cache, if it is present.
|
reactor.core.publisher.Mono<Boolean> |
remove(K key,
V oldValue)
This method atomically removes a key's mapping only if it is currently mapped to the
provided value.
|
reactor.core.publisher.Mono<Void> |
removeAll(Set<? extends K> keys)
This method deletes the entries for the given keys.
|
reactor.core.publisher.Mono<Boolean> |
replace(K key,
V value)
This method atomically replaces an entry only if the key is currently mapped to some
value.
|
reactor.core.publisher.Mono<Boolean> |
replace(K key,
V oldValue,
V newValue)
This method atomically replaces an entry only if the key is currently mapped to a
given value.
|
reactor.core.publisher.Mono<V> get(K key)
CacheLoader
will try to load the entry.key
- the key whose value should be returnedIllegalStateException
- if the cache is in a closed stateNullPointerException
- if the key is nulljavax.cache.CacheException
- if there is a problem retrieving the entry from the cachereactor.core.publisher.Mono<Map<K,V>> getAll(Set<? extends K> keys)
CacheReactive
, returning them as a Map
of the associated values.
If the cache uses the read-through pattern, and the method would return null for a key
because an entry is not present in the cache, the Cache's CacheLoader
will try to
load the entry. If a key's entry cannot be loaded, the key will not appear in the Map.keys
- The keys whose values should be returned.NullPointerException
- if keys is null or contains a nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem retrieving the entries from the cachereactor.core.publisher.Mono<Boolean> containsKey(K key)
CacheReactive
has a mapping for a key k such that key.equals(k).key
- the key with a possible mapping in the cache.NullPointerException
- if key is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Void> put(K key, V value)
CacheReactive
already has a mapping for the key, the previous
value is replaced by the given value V.
This occurs if and only if c.containsKey(k)
would return true.)key
- the key to place in the cachevalue
- the value to associate with the given keyNullPointerException
- if the key or value is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<V> getAndPut(K key, V value)
c.containsKey(k)
would return true.)
If there was no value already in the cache, the method returns null.key
- the key to place in the cachevalue
- the value to associate with the given keyNullPointerException
- if the key or value is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Void> putAll(Map<? extends K,? extends V> map)
CacheReactive
.
This method is equivalent to calling
put(k, v)
on this cache one time for each mapping
from key k to value v in the given Map.
Individual puts may occur in any order.
If entries in the cache corresponding to entries in the Map, or the Map itself, is
changed or removed during this operation, then the behavior of this method is
not defined.
If default consistency mode is enabled, then each put is atomic but not
the entire putAll operation. Listeners can observe individual updates.map
- the Map that contains the entries to be copied to the cacheNullPointerException
- if the map is null or contains null keys or values.IllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cache.reactor.core.publisher.Mono<Boolean> putIfAbsent(K key, V value)
key
- the key to place in the cachevalue
- the value to associate with the given keyNullPointerException
- if the key or value is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Boolean> remove(K key)
key
- the key whose mapping will be deletedNullPointerException
- if the key is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Boolean> remove(K key, V oldValue)
key
- the key whose mapping will be deletedoldValue
- the value that should be mapped to the given keyNullPointerException
- if the key is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<V> getAndRemove(K key)
key
- the given keyNullPointerException
- if the key is null.IllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Boolean> replace(K key, V oldValue, V newValue)
key
- the key associated with the given oldValueoldValue
- the value that should be associated with the keynewValue
- the value that will be associated with the keyNullPointerException
- if the key or values are nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Boolean> replace(K key, V value)
key
- the key mapped to the given valuevalue
- the value mapped to the given keyNullPointerException
- if the key or value is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<V> getAndReplace(K key, V value)
key
- the key associated with the given valuevalue
- the value associated with the given keyNullPointerException
- if the key or value is nullIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Void> removeAll(Set<? extends K> keys)
CacheEntryRemovedListener
s
• if the cache is a write-through cache, the CacheWriter
If the key set is empty, the CacheWriter
is not called.keys
- the keys to removeNullPointerException
- if keys is null or if it contains a null keyIllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cachereactor.core.publisher.Mono<Void> clear()
CacheWriter
s.IllegalStateException
- if the cache is in a closed statejavax.cache.CacheException
- if there is a problem with the cacheCopyright © 2014–2019 Redisson. All rights reserved.