Interface RMapReactive<K,V>
-
- Type Parameters:
K- keyV- value
- All Superinterfaces:
RExpirableReactive,RObjectReactive
- All Known Subinterfaces:
RMapCacheReactive<K,V>
public interface RMapReactive<K,V> extends RExpirableReactive
Reactive interface for Redis based implementation ofConcurrentMapandMapThis map uses serialized state of key instead of hashCode or equals methods. This map doesn't allow to store
nullas key or value.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description reactor.core.publisher.Mono<V>addAndGet(K key, Number delta)Adds the givendeltato the current value by mappedkey.reactor.core.publisher.Mono<V>compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)Computes a new mapping for the specified key and its current mapped value.reactor.core.publisher.Mono<V>computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)Computes a mapping for the specified key if it's not mapped before.reactor.core.publisher.Mono<V>computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)Computes a mapping for the specified key only if it's already mapped.reactor.core.publisher.Mono<Boolean>containsKey(Object key)Returnstrueif this map contains map entry mapped by specifiedkey, otherwisefalsereactor.core.publisher.Mono<Boolean>containsValue(Object value)Returnstrueif this map contains any map entry with specifiedvalue, otherwisefalsereactor.core.publisher.Flux<Map.Entry<K,V>>entryIterator()Returns iterator over map entries collection.reactor.core.publisher.Flux<Map.Entry<K,V>>entryIterator(int count)Returns iterator over map entries collection.reactor.core.publisher.Flux<Map.Entry<K,V>>entryIterator(String pattern)Returns iterator over map entries collection.reactor.core.publisher.Flux<Map.Entry<K,V>>entryIterator(String pattern, int count)Returns iterator over map entries collection.reactor.core.publisher.Mono<Boolean>fastPut(K key, V value)Stores the specifiedvaluemapped by specifiedkey.reactor.core.publisher.Mono<Boolean>fastPutIfAbsent(K key, V value)Stores the specifiedvaluemapped by specifiedkeyonly if there is no value with specifiedkeystored before.reactor.core.publisher.Mono<Boolean>fastPutIfExists(K key, V value)Stores the specifiedvaluemapped bykeyonly if mapping already exists.reactor.core.publisher.Mono<Long>fastRemove(K... keys)Removes map entries mapped by specifiedkeys.reactor.core.publisher.Mono<V>get(K key)Returns the value mapped by definedkeyornullif value is absent.reactor.core.publisher.Mono<Map<K,V>>getAll(Set<K> keys)Returns map slice contained the mappings with definedkeys.RLockReactivegetFairLock(K key)ReturnsRLockinstance associated with keyRLockReactivegetLock(K key)ReturnsRLockinstance associated with keyRPermitExpirableSemaphoreReactivegetPermitExpirableSemaphore(K key)ReturnsRPermitExpirableSemaphoreinstance associated with keyRReadWriteLockReactivegetReadWriteLock(K key)ReturnsRReadWriteLockinstance associated with keyRSemaphoreReactivegetSemaphore(K key)ReturnsRSemaphoreinstance associated with keyreactor.core.publisher.Flux<K>keyIterator()Returns iterator over key set of this map.reactor.core.publisher.Flux<K>keyIterator(int count)Returns iterator over key set of this map.reactor.core.publisher.Flux<K>keyIterator(String pattern)Returns iterator over key set of this map.reactor.core.publisher.Flux<K>keyIterator(String pattern, int count)Returns iterator over key set of this map.reactor.core.publisher.Mono<Void>loadAll(boolean replaceExistingValues, int parallelism)Loads all map entries to this Redis map usingMapLoader.reactor.core.publisher.Mono<Void>loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)Loads map entries usingMapLoaderwhose keys are listed in definedkeysparameter.reactor.core.publisher.Mono<V>merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)Associates specified key with the given value if key isn't already associated with a value.reactor.core.publisher.Mono<V>put(K key, V value)Stores the specifiedvaluemapped by specifiedkey.reactor.core.publisher.Mono<Void>putAll(Map<? extends K,? extends V> map)Stores map entries specified inmapobject in batch mode.reactor.core.publisher.Mono<V>putIfAbsent(K key, V value)Stores the specifiedvaluemapped by specifiedkeyonly if there is no value with specifiedkeystored before.reactor.core.publisher.Mono<V>putIfExists(K key, V value)Stores the specifiedvaluemapped bykeyonly if mapping already exists.reactor.core.publisher.Mono<Map<K,V>>randomEntries(int count)Returns random map entries from this map limited bycountreactor.core.publisher.Mono<Set<K>>randomKeys(int count)Returns random keys from this map limited bycountreactor.core.publisher.Mono<Set<Map.Entry<K,V>>>readAllEntrySet()Read all map entries at oncereactor.core.publisher.Mono<Set<K>>readAllKeySet()Read all keys at oncereactor.core.publisher.Mono<Map<K,V>>readAllMap()Read all map as local instance at oncereactor.core.publisher.Mono<Collection<V>>readAllValues()Read all values at oncereactor.core.publisher.Mono<Boolean>remove(Object key, Object value)Removes map entry only if it exists with specifiedkeyandvalue.reactor.core.publisher.Mono<V>remove(K key)Removes map entry by specifiedkeyand returns value.reactor.core.publisher.Mono<V>replace(K key, V value)Replaces previous value with a newvaluemapped by specifiedkey.reactor.core.publisher.Mono<Boolean>replace(K key, V oldValue, V newValue)Replaces previousoldValuewith anewValuemapped by specifiedkey.reactor.core.publisher.Mono<Integer>size()Returns size of this mapreactor.core.publisher.Flux<V>valueIterator()Returns iterator over values collection of this map.reactor.core.publisher.Flux<V>valueIterator(int count)Returns iterator over values collection of this map.reactor.core.publisher.Flux<V>valueIterator(String pattern)Returns iterator over values collection of this map.reactor.core.publisher.Flux<V>valueIterator(String pattern, int count)Returns iterator over values collection of this map.reactor.core.publisher.Mono<Integer>valueSize(K key)Returns size of value mapped by key in bytes-
Methods inherited from interface org.redisson.api.RExpirableReactive
clearExpire, expire, expireAt, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RObjectReactive
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
-
-
-
Method Detail
-
merge
reactor.core.publisher.Mono<V> merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
Associates specified key with the given value if key isn't already associated with a value. Otherwise, replaces the associated value with the results of the given remapping function, or removes if the result isnull.- Parameters:
key- - map keyvalue- - value to be merged with the existing value associated with the key or to be associated with the key, if no existing valueremappingFunction- - the function is invoked with the existing value to compute new value- Returns:
- new value associated with the specified key or
nullif no value associated with the key
-
compute
reactor.core.publisher.Mono<V> compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Computes a new mapping for the specified key and its current mapped value.- Parameters:
key- - map keyremappingFunction- - function to compute a value- Returns:
- the new value associated with the specified key, or
nullif none
-
computeIfAbsent
reactor.core.publisher.Mono<V> computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
Computes a mapping for the specified key if it's not mapped before.- Parameters:
key- - map keymappingFunction- - function to compute a value- Returns:
- current or new computed value associated with
the specified key, or
nullif the computed value is null
-
computeIfPresent
reactor.core.publisher.Mono<V> computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Computes a mapping for the specified key only if it's already mapped.- Parameters:
key- - map keyremappingFunction- - function to compute a value- Returns:
- the new value associated with the specified key, or null if none
-
loadAll
reactor.core.publisher.Mono<Void> loadAll(boolean replaceExistingValues, int parallelism)
Loads all map entries to this Redis map usingMapLoader.- Parameters:
replaceExistingValues- -trueif existed values should be replaced,falseotherwise.parallelism- - parallelism level, used to increase speed of process execution- Returns:
- void
-
loadAll
reactor.core.publisher.Mono<Void> loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Loads map entries usingMapLoaderwhose keys are listed in definedkeysparameter.- Parameters:
keys- - map keysreplaceExistingValues- -trueif existed values should be replaced,falseotherwise.parallelism- - parallelism level, used to increase speed of process execution- Returns:
- void
-
valueSize
reactor.core.publisher.Mono<Integer> valueSize(K key)
Returns size of value mapped by key in bytes- Parameters:
key- - map key- Returns:
- size of value
-
getAll
reactor.core.publisher.Mono<Map<K,V>> getAll(Set<K> keys)
Returns map slice contained the mappings with definedkeys.If map doesn't contain value/values for specified key/keys and
MapLoaderis defined then value/values will be loaded in read-through mode.The returned map is NOT backed by the original map.
- Parameters:
keys- - map keys- Returns:
- Map slice
-
putAll
reactor.core.publisher.Mono<Void> putAll(Map<? extends K,? extends V> map)
Stores map entries specified inmapobject in batch mode.If
MapWriteris defined then map entries will be stored in write-through mode.- Parameters:
map- mappings to be stored in this map- Returns:
- void
-
addAndGet
reactor.core.publisher.Mono<V> addAndGet(K key, Number delta)
Adds the givendeltato the current value by mappedkey. Works only for numeric values!- Parameters:
key- - map keydelta- the value to add- Returns:
- the updated value
-
containsValue
reactor.core.publisher.Mono<Boolean> containsValue(Object value)
Returnstrueif this map contains any map entry with specifiedvalue, otherwisefalse- Parameters:
value- - map value- Returns:
trueif this map contains any map entry with specifiedvalue, otherwisefalse
-
containsKey
reactor.core.publisher.Mono<Boolean> containsKey(Object key)
Returnstrueif this map contains map entry mapped by specifiedkey, otherwisefalse- Parameters:
key- - map key- Returns:
trueif this map contains map entry mapped by specifiedkey, otherwisefalse
-
size
reactor.core.publisher.Mono<Integer> size()
Returns size of this map- Returns:
- size
-
fastRemove
reactor.core.publisher.Mono<Long> fastRemove(K... keys)
Removes map entries mapped by specifiedkeys.Works faster than
but not returning the value.remove(Object)If
MapWriteris defined thenkeysare deleted in write-through mode.- Parameters:
keys- - map keys- Returns:
- the number of keys that were removed from the hash, not including specified but non existing keys
-
fastPut
reactor.core.publisher.Mono<Boolean> fastPut(K key, V value)
Stores the specifiedvaluemapped by specifiedkey.Works faster than
but not returning previous value.put(Object, Object)Returns
trueif key is a new key in the hash and value was set orfalseif key already exists in the hash and the value was updated.If
MapWriteris defined then map entry is stored in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
trueif key is a new key in the hash and value was set.falseif key already exists in the hash and the value was updated.
-
fastPutIfAbsent
reactor.core.publisher.Mono<Boolean> fastPutIfAbsent(K key, V value)
Stores the specifiedvaluemapped by specifiedkeyonly if there is no value with specifiedkeystored before.Returns
trueif key is a new one in the hash and value was set orfalseif key already exists in the hash and change hasn't been made.Works faster than
but not returning the previous value associated withputIfAbsent(Object, Object)keyIf
MapWriteris defined then new map entry is stored in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
trueif key is a new one in the hash and value was set.falseif key already exists in the hash and change hasn't been made.
-
readAllKeySet
reactor.core.publisher.Mono<Set<K>> readAllKeySet()
Read all keys at once- Returns:
- keys
-
readAllValues
reactor.core.publisher.Mono<Collection<V>> readAllValues()
Read all values at once- Returns:
- values
-
readAllEntrySet
reactor.core.publisher.Mono<Set<Map.Entry<K,V>>> readAllEntrySet()
Read all map entries at once- Returns:
- entries
-
readAllMap
reactor.core.publisher.Mono<Map<K,V>> readAllMap()
Read all map as local instance at once- Returns:
- map
-
get
reactor.core.publisher.Mono<V> get(K key)
Returns the value mapped by definedkeyornullif value is absent.If map doesn't contain value for specified key and
MapLoaderis defined then value will be loaded in read-through mode.- Parameters:
key- the key- Returns:
- the value mapped by defined
keyornullif value is absent
-
put
reactor.core.publisher.Mono<V> put(K key, V value)
Stores the specifiedvaluemapped by specifiedkey. Returns previous value if map entry with specifiedkeyalready existed.If
MapWriteris defined then map entry is stored in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
- previous associated value
-
remove
reactor.core.publisher.Mono<V> remove(K key)
Removes map entry by specifiedkeyand returns value.If
MapWriteris defined thenkeyis deleted in write-through mode.- Parameters:
key- - map key- Returns:
- deleted value,
nullif map entry doesn't exist
-
replace
reactor.core.publisher.Mono<V> replace(K key, V value)
Replaces previous value with a newvaluemapped by specifiedkey. Returnsnullif there is no map entry stored before and doesn't store new map entry.If
MapWriteris defined then newvalueis written in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
- previous associated value
or
nullif there is no map entry stored before and doesn't store new map entry
-
replace
reactor.core.publisher.Mono<Boolean> replace(K key, V oldValue, V newValue)
Replaces previousoldValuewith anewValuemapped by specifiedkey. Returnsfalseif previous value doesn't exist or equal tooldValue.If
MapWriteris defined thennewValueis written in write-through mode.- Parameters:
key- - map keyoldValue- - map old valuenewValue- - map new value- Returns:
trueif value has been replaced otherwisefalse.
-
remove
reactor.core.publisher.Mono<Boolean> remove(Object key, Object value)
Removes map entry only if it exists with specifiedkeyandvalue.If
MapWriteris defined thenkeyis deleted in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
trueif map entry has been removed otherwisefalse.
-
putIfAbsent
reactor.core.publisher.Mono<V> putIfAbsent(K key, V value)
Stores the specifiedvaluemapped by specifiedkeyonly if there is no value with specifiedkeystored before.If
MapWriteris defined then new map entry is stored in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
nullif key is a new one in the hash and value was set. Previous value if key already exists in the hash and change hasn't been made.
-
putIfExists
reactor.core.publisher.Mono<V> putIfExists(K key, V value)
Stores the specifiedvaluemapped bykeyonly if mapping already exists.If
MapWriteris defined then new map entry is stored in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
nullif key doesn't exist in the hash and value hasn't been set. Previous value if key already exists in the hash and new value has been stored.
-
randomKeys
reactor.core.publisher.Mono<Set<K>> randomKeys(int count)
Returns random keys from this map limited bycount- Parameters:
count- - keys amount to return- Returns:
- random keys
-
randomEntries
reactor.core.publisher.Mono<Map<K,V>> randomEntries(int count)
Returns random map entries from this map limited bycount- Parameters:
count- - entries amount to return- Returns:
- random entries
-
fastPutIfExists
reactor.core.publisher.Mono<Boolean> fastPutIfExists(K key, V value)
Stores the specifiedvaluemapped bykeyonly if mapping already exists.Returns
trueif key is a new one in the hash and value was set orfalseif key already exists in the hash and change hasn't been made.Works faster than
but doesn't return previous value associated withputIfExists(Object, Object)keyIf
MapWriteris defined then new map entry is stored in write-through mode.- Parameters:
key- - map keyvalue- - map value- Returns:
trueif key already exists in the hash and new value has been stored.falseif key doesn't exist in the hash and value hasn't been set.
-
entryIterator
reactor.core.publisher.Flux<Map.Entry<K,V>> entryIterator()
Returns iterator over map entries collection. Map entries are loaded in batch. Batch size is10.- Returns:
- iterator
- See Also:
readAllEntrySet()
-
entryIterator
reactor.core.publisher.Flux<Map.Entry<K,V>> entryIterator(int count)
Returns iterator over map entries collection. Map entries are loaded in batch. Batch size is defined bycountparam.- Parameters:
count- - size of entries batch- Returns:
- iterator
- See Also:
readAllEntrySet()
-
entryIterator
reactor.core.publisher.Flux<Map.Entry<K,V>> entryIterator(String pattern)
Returns iterator over map entries collection. Map entries are loaded in batch. Batch size is10. IfkeyPatternis not null then only entries mapped by matched keys of this pattern are loaded. Supported glob-style patterns:h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
- Parameters:
pattern- - key pattern- Returns:
- iterator
- See Also:
readAllEntrySet()
-
entryIterator
reactor.core.publisher.Flux<Map.Entry<K,V>> entryIterator(String pattern, int count)
Returns iterator over map entries collection. Map entries are loaded in batch. Batch size is defined bycountparam. IfkeyPatternis not null then only entries mapped by matched keys of this pattern are loaded. Supported glob-style patterns:h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
- Parameters:
pattern- - key patterncount- - size of entries batch- Returns:
- iterator
- See Also:
readAllEntrySet()
-
valueIterator
reactor.core.publisher.Flux<V> valueIterator()
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is10.- Returns:
- iterator
- See Also:
readAllValues()
-
valueIterator
reactor.core.publisher.Flux<V> valueIterator(int count)
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is defined bycountparam.- Parameters:
count- - size of values batch- Returns:
- iterator
- See Also:
readAllValues()
-
valueIterator
reactor.core.publisher.Flux<V> valueIterator(String pattern)
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is10. IfkeyPatternis not null then only values mapped by matched keys of this pattern are loaded.Use
org.redisson.client.codec.StringCodecfor Map keys.Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
- Parameters:
pattern- - key pattern- Returns:
- iterator
- See Also:
readAllValues()
-
valueIterator
reactor.core.publisher.Flux<V> valueIterator(String pattern, int count)
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is defined bycountparam. IfkeyPatternis not null then only values mapped by matched keys of this pattern are loaded.Use
org.redisson.client.codec.StringCodecfor Map keys.Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
- Parameters:
pattern- - key patterncount- - size of values batch- Returns:
- iterator
- See Also:
readAllValues()
-
keyIterator
reactor.core.publisher.Flux<K> keyIterator()
Returns iterator over key set of this map. Keys are loaded in batch. Batch size is10.- Returns:
- iterator
- See Also:
readAllKeySet()
-
keyIterator
reactor.core.publisher.Flux<K> keyIterator(int count)
Returns iterator over key set of this map. Keys are loaded in batch. Batch size is defined bycountparam.- Parameters:
count- - size of keys batch- Returns:
- iterator
- See Also:
readAllKeySet()
-
keyIterator
reactor.core.publisher.Flux<K> keyIterator(String pattern)
Returns iterator over key set of this map. Ifpatternis not null then only keys match this pattern are loaded.Use
org.redisson.client.codec.StringCodecfor Map keys.Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
- Parameters:
pattern- - key pattern- Returns:
- iterator
- See Also:
readAllKeySet()
-
keyIterator
reactor.core.publisher.Flux<K> keyIterator(String pattern, int count)
Returns iterator over key set of this map. Ifpatternis not null then only keys match this pattern are loaded. Keys are loaded in batch. Batch size is defined bycountparam.Use
org.redisson.client.codec.StringCodecfor Map keys.Supported glob-style patterns:
h?llo subscribes to hello, hallo and hxllo
h*llo subscribes to hllo and heeeello
h[ae]llo subscribes to hello and hallo, but not hillo
- Parameters:
pattern- - key patterncount- - size of keys batch- Returns:
- iterator
- See Also:
readAllKeySet()
-
getPermitExpirableSemaphore
RPermitExpirableSemaphoreReactive getPermitExpirableSemaphore(K key)
ReturnsRPermitExpirableSemaphoreinstance associated with key- Parameters:
key- - map key- Returns:
- permitExpirableSemaphore
-
getSemaphore
RSemaphoreReactive getSemaphore(K key)
ReturnsRSemaphoreinstance associated with key- Parameters:
key- - map key- Returns:
- semaphore
-
getFairLock
RLockReactive getFairLock(K key)
ReturnsRLockinstance associated with key- Parameters:
key- - map key- Returns:
- fairLock
-
getReadWriteLock
RReadWriteLockReactive getReadWriteLock(K key)
ReturnsRReadWriteLockinstance associated with key- Parameters:
key- - map key- Returns:
- readWriteLock
-
getLock
RLockReactive getLock(K key)
ReturnsRLockinstance associated with key- Parameters:
key- - map key- Returns:
- lock
-
-