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
map functions- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.reactivestreams.Publisher<V>
addAndGet(K key, Number value)
org.reactivestreams.Publisher<Boolean>
containsKey(Object key)
org.reactivestreams.Publisher<Boolean>
containsValue(Object value)
org.reactivestreams.Publisher<Map.Entry<K,V>>
entryIterator()
Returns iterator over map entries collection.org.reactivestreams.Publisher<Map.Entry<K,V>>
entryIterator(int count)
Returns iterator over map entries collection.org.reactivestreams.Publisher<Map.Entry<K,V>>
entryIterator(String pattern)
Returns iterator over map entries collection.org.reactivestreams.Publisher<Map.Entry<K,V>>
entryIterator(String pattern, int count)
Returns iterator over map entries collection.org.reactivestreams.Publisher<Boolean>
fastPut(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in async manner.org.reactivestreams.Publisher<Boolean>
fastPutIfAbsent(K key, V value)
Associates the specifiedvalue
with the specifiedkey
only if there is no any association with specifiedkey
.org.reactivestreams.Publisher<Long>
fastRemove(K... keys)
Removeskeys
from map by one operation in async manner.org.reactivestreams.Publisher<V>
get(K key)
Returns the value to which the specified key is mapped, ornull
if this map contains no mapping for the key.org.reactivestreams.Publisher<Map<K,V>>
getAll(Set<K> keys)
Gets a map slice contained the mappings with definedkeys
by one operation.org.reactivestreams.Publisher<K>
keyIterator()
Returns iterator over key set of this map.org.reactivestreams.Publisher<K>
keyIterator(int count)
Returns iterator over key set of this map.org.reactivestreams.Publisher<K>
keyIterator(String pattern)
Returns iterator over key set of this map.org.reactivestreams.Publisher<K>
keyIterator(String pattern, int count)
Returns iterator over key set of this map.org.reactivestreams.Publisher<Void>
loadAll(boolean replaceExistingValues, int parallelism)
Loads all map entries to this Redis map usingMapLoader
.org.reactivestreams.Publisher<Void>
loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Loads map entries usingMapLoader
whose keys are listed in definedkeys
parameter.org.reactivestreams.Publisher<V>
put(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in async manner.org.reactivestreams.Publisher<Void>
putAll(Map<? extends K,? extends V> map)
Associates the specifiedvalue
with the specifiedkey
in batch.org.reactivestreams.Publisher<V>
putIfAbsent(K key, V value)
Associates the specifiedvalue
with the specifiedkey
only if there is no any association with specifiedkey
.org.reactivestreams.Publisher<Set<Map.Entry<K,V>>>
readAllEntrySet()
Read all map entries at onceorg.reactivestreams.Publisher<Set<K>>
readAllKeySet()
Read all keys at onceorg.reactivestreams.Publisher<Map<K,V>>
readAllMap()
Read all map as local instance at onceorg.reactivestreams.Publisher<Collection<V>>
readAllValues()
Read all values at onceorg.reactivestreams.Publisher<Boolean>
remove(Object key, Object value)
Removeskey
from map only if it associated withvalue
.org.reactivestreams.Publisher<V>
remove(K key)
Removeskey
from map and returns associated value in async manner.org.reactivestreams.Publisher<V>
replace(K key, V value)
Replaces previous value with a newvalue
associated with thekey
.org.reactivestreams.Publisher<Boolean>
replace(K key, V oldValue, V newValue)
Replaces previousoldValue
with anewValue
associated with thekey
.org.reactivestreams.Publisher<Integer>
size()
org.reactivestreams.Publisher<V>
valueIterator()
Returns iterator over values collection of this map.org.reactivestreams.Publisher<V>
valueIterator(int count)
Returns iterator over values collection of this map.org.reactivestreams.Publisher<V>
valueIterator(String pattern)
Returns iterator over values collection of this map.org.reactivestreams.Publisher<V>
valueIterator(String pattern, int count)
Returns iterator over values collection of this map.org.reactivestreams.Publisher<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, remainTimeToLive
-
-
-
-
Method Detail
-
loadAll
org.reactivestreams.Publisher<Void> loadAll(boolean replaceExistingValues, int parallelism)
Loads all map entries to this Redis map usingMapLoader
.- Parameters:
replaceExistingValues
- -true
if existed values should be replaced,false
otherwise.parallelism
- - parallelism level, used to increase speed of process execution- Returns:
- void
-
loadAll
org.reactivestreams.Publisher<Void> loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Loads map entries usingMapLoader
whose keys are listed in definedkeys
parameter.- Parameters:
keys
- - map keysreplaceExistingValues
- -true
if existed values should be replaced,false
otherwise.parallelism
- - parallelism level, used to increase speed of process execution- Returns:
- void
-
valueSize
org.reactivestreams.Publisher<Integer> valueSize(K key)
Returns size of value mapped by key in bytes- Parameters:
key
- - map key- Returns:
- size of value
-
getAll
org.reactivestreams.Publisher<Map<K,V>> getAll(Set<K> keys)
Gets a map slice contained the mappings with definedkeys
by one operation.If map doesn't contain value/values for specified key/keys and
MapLoader
is 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
org.reactivestreams.Publisher<Void> putAll(Map<? extends K,? extends V> map)
Associates the specifiedvalue
with the specifiedkey
in batch.If
MapWriter
is defined then new map entries are stored in write-through mode.- Parameters:
map
- mappings to be stored in this map- Returns:
- void
-
size
org.reactivestreams.Publisher<Integer> size()
-
fastRemove
org.reactivestreams.Publisher<Long> fastRemove(K... keys)
Removeskeys
from map by one operation in async manner.Works faster than
but doesn't return the value associated withremove(Object, Object)
key
.If
MapWriter
is defined thenkeys
are 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
org.reactivestreams.Publisher<Boolean> fastPut(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in async manner.Works faster than
but not returning the previous value associated withput(Object, Object)
key
If
MapWriter
is defined then new map entry is stored in write-through mode.- Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if key is a new one in the hash and value was set.false
if key already exists in the hash and the value was updated.
-
fastPutIfAbsent
org.reactivestreams.Publisher<Boolean> fastPutIfAbsent(K key, V value)
Associates the specifiedvalue
with the specifiedkey
only if there is no any association with specifiedkey
.Works faster than
but not returning the previous value associated withputIfAbsent(Object, Object)
key
If
MapWriter
is defined then new map entry is stored in write-through mode.- Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if key is a new one in the hash and value was set.false
if key already exists in the hash and change hasn't been made.
-
readAllKeySet
org.reactivestreams.Publisher<Set<K>> readAllKeySet()
Read all keys at once- Returns:
- keys
-
readAllValues
org.reactivestreams.Publisher<Collection<V>> readAllValues()
Read all values at once- Returns:
- values
-
readAllEntrySet
org.reactivestreams.Publisher<Set<Map.Entry<K,V>>> readAllEntrySet()
Read all map entries at once- Returns:
- entries
-
readAllMap
org.reactivestreams.Publisher<Map<K,V>> readAllMap()
Read all map as local instance at once- Returns:
- map
-
get
org.reactivestreams.Publisher<V> get(K key)
Returns the value to which the specified key is mapped, ornull
if this map contains no mapping for the key.If map doesn't contain value for specified key and
MapLoader
is defined then value will be loaded in read-through mode.- Parameters:
key
- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
null
if this map contains no mapping for the key
-
put
org.reactivestreams.Publisher<V> put(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in async manner.If
MapWriter
is defined then new map entry is stored in write-through mode.- Parameters:
key
- - map keyvalue
- - map value- Returns:
- previous associated value
-
remove
org.reactivestreams.Publisher<V> remove(K key)
Removeskey
from map and returns associated value in async manner.If
MapWriter
is defined thenkey
is deleted in write-through mode.- Parameters:
key
- - map key- Returns:
- deleted value or
null
if there wasn't any association
-
replace
org.reactivestreams.Publisher<V> replace(K key, V value)
Replaces previous value with a newvalue
associated with thekey
. If there wasn't any association before then method returnsnull
.If
MapWriter
is defined then newvalue
is written in write-through mode.- Parameters:
key
- - map keyvalue
- - map value- Returns:
- previous associated value
or
null
if there wasn't any association and change hasn't been made
-
replace
org.reactivestreams.Publisher<Boolean> replace(K key, V oldValue, V newValue)
Replaces previousoldValue
with anewValue
associated with thekey
. If previous value doesn't exist or equal tooldValue
then method returnsfalse
.If
MapWriter
is defined thennewValue
is written in write-through mode.- Parameters:
key
- - map keyoldValue
- - map old valuenewValue
- - map new value- Returns:
true
if value has been replaced otherwisefalse
.
-
remove
org.reactivestreams.Publisher<Boolean> remove(Object key, Object value)
Removeskey
from map only if it associated withvalue
.If
MapWriter
is defined thenkey
is deleted in write-through mode.- Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if map entry has been replaced otherwisefalse
.
-
putIfAbsent
org.reactivestreams.Publisher<V> putIfAbsent(K key, V value)
Associates the specifiedvalue
with the specifiedkey
only if there is no any association with specifiedkey
.If
MapWriter
is defined then new map entry is stored in write-through mode.- Parameters:
key
- - map keyvalue
- - map value- Returns:
null
if 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.
-
entryIterator
org.reactivestreams.Publisher<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
org.reactivestreams.Publisher<Map.Entry<K,V>> entryIterator(int count)
Returns iterator over map entries collection. Map entries are loaded in batch. Batch size is defined bycount
param.- Parameters:
count
- - size of entries batch- Returns:
- iterator
- See Also:
readAllEntrySet()
-
entryIterator
org.reactivestreams.Publisher<Map.Entry<K,V>> entryIterator(String pattern)
Returns iterator over map entries collection. Map entries are loaded in batch. Batch size is10
. IfkeyPattern
is 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
org.reactivestreams.Publisher<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 bycount
param. IfkeyPattern
is 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
org.reactivestreams.Publisher<V> valueIterator()
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is10
.- Returns:
- iterator
- See Also:
readAllValues()
-
valueIterator
org.reactivestreams.Publisher<V> valueIterator(int count)
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is defined bycount
param.- Parameters:
count
- - size of values batch- Returns:
- iterator
- See Also:
readAllValues()
-
valueIterator
org.reactivestreams.Publisher<V> valueIterator(String pattern)
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is10
. IfkeyPattern
is not null then only values 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:
readAllValues()
-
valueIterator
org.reactivestreams.Publisher<V> valueIterator(String pattern, int count)
Returns iterator over values collection of this map. Values are loaded in batch. Batch size is defined bycount
param. IfkeyPattern
is not null then only values 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 values batch- Returns:
- iterator
- See Also:
readAllValues()
-
keyIterator
org.reactivestreams.Publisher<K> keyIterator()
Returns iterator over key set of this map. Keys are loaded in batch. Batch size is10
.- Returns:
- iterator
- See Also:
readAllKeySet()
-
keyIterator
org.reactivestreams.Publisher<K> keyIterator(int count)
Returns iterator over key set of this map. Keys are loaded in batch. Batch size is defined bycount
param.- Parameters:
count
- - size of keys batch- Returns:
- iterator
- See Also:
readAllKeySet()
-
keyIterator
org.reactivestreams.Publisher<K> keyIterator(String pattern)
Returns iterator over key set of this map. Ifpattern
is not null then only keys match 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:
readAllKeySet()
-
keyIterator
org.reactivestreams.Publisher<K> keyIterator(String pattern, int count)
Returns iterator over key set of this map. Ifpattern
is not null then only keys match this pattern are loaded. Keys are loaded in batch. Batch size is defined bycount
param. 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()
-
-