Interface RMapAsync<K,V>
-
- Type Parameters:
K
- keyV
- value
- All Superinterfaces:
RExpirableAsync
,RObjectAsync
- All Known Subinterfaces:
RLocalCachedMap<K,V>
,RMap<K,V>
,RMapCache<K,V>
,RMapCacheAsync<K,V>
- All Known Implementing Classes:
RedissonLocalCachedMap
,RedissonMap
,RedissonMapCache
,RedissonTransactionalLocalCachedMap
,RedissonTransactionalMap
,RedissonTransactionalMapCache
public interface RMapAsync<K,V> extends RExpirableAsync
Distributed async implementation ofMap
. This map doesn't allow to storenull
as key or value.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RFuture<V>
addAndGetAsync(K key, Number value)
Atomically adds the givendelta
to the current value by mappedkey
.RFuture<Boolean>
containsKeyAsync(Object key)
RFuture<Boolean>
containsValueAsync(Object value)
RFuture<Boolean>
fastPutAsync(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in async manner.RFuture<Boolean>
fastPutIfAbsentAsync(K key, V value)
Associates the specifiedvalue
with the specifiedkey
only if there is no any association with specifiedkey
.RFuture<Long>
fastRemoveAsync(K... keys)
Removeskeys
from map by one operation in async manner.RFuture<Boolean>
fastReplaceAsync(K key, V value)
Replaces previous value with a newvalue
associated with thekey
.RFuture<Map<K,V>>
getAllAsync(Set<K> keys)
Gets a map slice contained the mappings with definedkeys
by one operation.RFuture<V>
getAsync(K key)
Returns the value to which the specified key is mapped, ornull
if this map contains no mapping for the key.RFuture<Void>
loadAllAsync(boolean replaceExistingValues, int parallelism)
Loads all map entries to this Redis map usingMapLoader
.RFuture<Void>
loadAllAsync(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Loads map entries usingMapLoader
whose keys are listed in definedkeys
parameter.RFuture<Void>
putAllAsync(Map<? extends K,? extends V> map)
Associates the specifiedvalue
with the specifiedkey
in batch.RFuture<Void>
putAllAsync(Map<? extends K,? extends V> map, int batchSize)
Associates the specifiedvalue
with the specifiedkey
in batch.RFuture<V>
putAsync(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in async manner.RFuture<V>
putIfAbsentAsync(K key, V value)
Associates the specifiedvalue
with the specifiedkey
only if there is no any association with specifiedkey
.RFuture<Set<Map.Entry<K,V>>>
readAllEntrySetAsync()
Read all map entries at onceRFuture<Set<K>>
readAllKeySetAsync()
Read all keys at onceRFuture<Map<K,V>>
readAllMapAsync()
Read all map as local instance at onceRFuture<Collection<V>>
readAllValuesAsync()
Read all values at onceRFuture<Boolean>
removeAsync(Object key, Object value)
Removeskey
from map only if it associated withvalue
.RFuture<V>
removeAsync(K key)
Removeskey
from map and returns associated value in async manner.RFuture<V>
replaceAsync(K key, V value)
Replaces previous value with a newvalue
associated with thekey
.RFuture<Boolean>
replaceAsync(K key, V oldValue, V newValue)
Replaces previousoldValue
with anewValue
associated with thekey
.RFuture<Integer>
sizeAsync()
Returns size of this mapRFuture<Integer>
valueSizeAsync(K key)
Returns size of value mapped by key in bytes-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
-
-
-
Method Detail
-
loadAllAsync
RFuture<Void> loadAllAsync(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
-
loadAllAsync
RFuture<Void> loadAllAsync(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
-
valueSizeAsync
RFuture<Integer> valueSizeAsync(K key)
Returns size of value mapped by key in bytes- Parameters:
key
- - map key- Returns:
- size of value
-
getAllAsync
RFuture<Map<K,V>> getAllAsync(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
-
putAllAsync
RFuture<Void> putAllAsync(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
-
putAllAsync
RFuture<Void> putAllAsync(Map<? extends K,? extends V> map, int batchSize)
Associates the specifiedvalue
with the specifiedkey
in batch. Batch inserted by chunks limited bybatchSize
amount to avoid OOM and/or Redis response timeout error for map with big size.If
MapWriter
is defined then new map entries are stored in write-through mode.- Parameters:
map
- mappings to be stored in this mapbatchSize
- - map chunk size- Returns:
- void
-
addAndGetAsync
RFuture<V> addAndGetAsync(K key, Number value)
Atomically adds the givendelta
to the current value by mappedkey
. Works only for numeric values!- Parameters:
key
- - map keyvalue
- - delta the value to add- Returns:
- the updated value
-
fastRemoveAsync
RFuture<Long> fastRemoveAsync(K... keys)
Removeskeys
from map by one operation in async manner.Works faster than
but doesn't return the value associated withremoveAsync(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
-
fastPutAsync
RFuture<Boolean> fastPutAsync(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in async manner.Works faster than
but not returning the previous value associated withputAsync(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.
-
fastReplaceAsync
RFuture<Boolean> fastReplaceAsync(K key, V value)
Replaces previous value with a newvalue
associated with thekey
.Works faster than
but not returning the previous value associated withreplaceAsync(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 exists and value was updated.false
if key doesn't exists and value wasn't updated.
-
fastPutIfAbsentAsync
RFuture<Boolean> fastPutIfAbsentAsync(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 withputIfAbsentAsync(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.
-
readAllValuesAsync
RFuture<Collection<V>> readAllValuesAsync()
Read all values at once- Returns:
- values
-
readAllEntrySetAsync
RFuture<Set<Map.Entry<K,V>>> readAllEntrySetAsync()
Read all map entries at once- Returns:
- entries
-
readAllMapAsync
RFuture<Map<K,V>> readAllMapAsync()
Read all map as local instance at once- Returns:
- map
-
getAsync
RFuture<V> getAsync(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
-
putAsync
RFuture<V> putAsync(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
-
removeAsync
RFuture<V> removeAsync(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
-
replaceAsync
RFuture<V> replaceAsync(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
-
replaceAsync
RFuture<Boolean> replaceAsync(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
.
-
removeAsync
RFuture<Boolean> removeAsync(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
.
-
putIfAbsentAsync
RFuture<V> putIfAbsentAsync(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.
-
-