Class RedissonMap<K,V>
- java.lang.Object
-
- org.redisson.RedissonObject
-
- org.redisson.RedissonMap<K,V>
-
- Type Parameters:
K
- keyV
- value
- All Implemented Interfaces:
ConcurrentMap<K,V>
,Map<K,V>
,RExpirable
,RExpirableAsync
,RMap<K,V>
,RMapAsync<K,V>
,RObject
,RObjectAsync
- Direct Known Subclasses:
RedissonLocalCachedMap
,RedissonMapCache
,RedissonTransactionalMap
public class RedissonMap<K,V> extends RedissonObject implements RMap<K,V>
Distributed and concurrent implementation ofConcurrentMap
andMap
- Author:
- Nikita Koksharov
-
-
Field Summary
-
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
-
Constructor Summary
Constructors Constructor Description RedissonMap(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options, WriteBehindService writeBehindService)
RedissonMap(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options, WriteBehindService writeBehindService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
addAndGet(K key, Number value)
Adds the givendelta
to the current value by mappedkey
.RFuture<V>
addAndGetAsync(K key, Number value)
Adds the givendelta
to the current value by mappedkey
.protected RFuture<V>
addAndGetOperationAsync(K key, Number value)
protected void
checkKey(Object key)
protected void
checkValue(Object value)
void
clear()
boolean
clearExpire()
Clear an expire timeout or expire date for object.RFuture<Boolean>
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.protected RFuture<Boolean>
clearExpireAsync(String... keys)
V
compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
RFuture<V>
computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Computes a new mapping for the specified key and its current mapped value.V
computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
RFuture<V>
computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction)
Computes a mapping for the specified key if it's not mapped before.V
computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
RFuture<V>
computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Computes a mapping for the specified key only if it's already mapped.boolean
containsKey(Object key)
Returnstrue
if this map contains map entry mapped by specifiedkey
, otherwisefalse
RFuture<Boolean>
containsKeyAsync(Object key)
Returnstrue
if this map contains map entry mapped by specifiedkey
, otherwisefalse
protected RFuture<Boolean>
containsKeyAsync(Object key, RPromise<V> promise)
boolean
containsValue(Object value)
Returnstrue
if this map contains any map entry with specifiedvalue
, otherwisefalse
RFuture<Boolean>
containsValueAsync(Object value)
Returnstrue
if this map contains any map entry with specifiedvalue
, otherwisefalse
protected Iterator<Map.Entry<K,V>>
entryIterator(String pattern, int count)
Set<Map.Entry<K,V>>
entrySet()
Returns map entries collection.Set<Map.Entry<K,V>>
entrySet(int count)
Returns map entries collection.Set<Map.Entry<K,V>>
entrySet(String keyPattern)
Returns map entries collection.Set<Map.Entry<K,V>>
entrySet(String keyPattern, int count)
Returns map entries collection.boolean
equals(Object o)
boolean
expire(long timeToLive, TimeUnit timeUnit)
Set a timeout for object.boolean
expire(Instant instant)
Set an expire date for object.RFuture<Boolean>
expireAsync(long timeToLive, TimeUnit timeUnit)
Set a timeout for object in async mode.protected RFuture<Boolean>
expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
RFuture<Boolean>
expireAsync(Instant instant)
Set an expire date for object.boolean
expireAt(long timestamp)
UseRExpirable.expire(Instant)
insteadboolean
expireAt(Date timestamp)
UseRExpirable.expire(Instant)
insteadRFuture<Boolean>
expireAtAsync(long timestamp)
UseRExpirableAsync.expireAsync(Instant)
insteadprotected RFuture<Boolean>
expireAtAsync(long timestamp, String... keys)
RFuture<Boolean>
expireAtAsync(Date timestamp)
UseRExpirableAsync.expireAsync(Instant)
insteadboolean
fastPut(K key, V value)
Stores the specifiedvalue
mapped by specifiedkey
.RFuture<Boolean>
fastPutAsync(K key, V value)
Stores the specifiedvalue
mapped by specifiedkey
.boolean
fastPutIfAbsent(K key, V value)
Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.RFuture<Boolean>
fastPutIfAbsentAsync(K key, V value)
Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.protected RFuture<Boolean>
fastPutIfAbsentOperationAsync(K key, V value)
boolean
fastPutIfExists(K key, V value)
Stores the specifiedvalue
mapped bykey
only if mapping already exists.RFuture<Boolean>
fastPutIfExistsAsync(K key, V value)
Stores the specifiedvalue
mapped bykey
only if mapping already exists.protected RFuture<Boolean>
fastPutIfExistsOperationAsync(K key, V value)
protected RFuture<Boolean>
fastPutOperationAsync(K key, V value)
long
fastRemove(K... keys)
Removes map entries mapped by specifiedkeys
.RFuture<Long>
fastRemoveAsync(K... keys)
Removes map entries mapped by specifiedkeys
.protected RFuture<Long>
fastRemoveOperationAsync(K... keys)
protected RFuture<List<Long>>
fastRemoveOperationBatchAsync(K... keys)
boolean
fastReplace(K key, V value)
Replaces previous value with a newvalue
mapped by specifiedkey
.RFuture<Boolean>
fastReplaceAsync(K key, V value)
Replaces previous value with a newvalue
mapped by specifiedkey
.protected RFuture<Boolean>
fastReplaceOperationAsync(K key, V value)
V
get(Object key)
Returns the value mapped by definedkey
ornull
if value is absent.Map<K,V>
getAll(Set<K> keys)
Returns map slice contained the mappings with definedkeys
.RFuture<Map<K,V>>
getAllAsync(Set<K> keys)
Returns map slice contained the mappings with definedkeys
.RFuture<Map<K,V>>
getAllOperationAsync(Set<K> keys)
RFuture<V>
getAsync(K key)
Returns the value mapped by definedkey
ornull
if value is absent.RCountDownLatch
getCountDownLatch(K key)
ReturnsRCountDownLatch
instance associated with keyRLock
getFairLock(K key)
ReturnsRLock
instance associated with keyRLock
getLock(K key)
ReturnsRLock
instance associated with keyRFuture<V>
getOperationAsync(K key)
RPermitExpirableSemaphore
getPermitExpirableSemaphore(K key)
ReturnsRPermitExpirableSemaphore
instance associated with keyRReadWriteLock
getReadWriteLock(K key)
ReturnsRReadWriteLock
instance associated with keyRSemaphore
getSemaphore(K key)
ReturnsRSemaphore
instance associated with keyint
hashCode()
protected boolean
hasNoLoader()
protected boolean
hasNoWriter()
boolean
isEmpty()
protected Iterator<K>
keyIterator(String pattern, int count)
Set<K>
keySet()
Returns key set of this map.Set<K>
keySet(int count)
Returns key set of this map.Set<K>
keySet(String pattern)
Returns key set of this map.Set<K>
keySet(String pattern, int count)
Returns key set of this map.void
loadAll(boolean replaceExistingValues, int parallelism)
Loads all map entries to this Redis map usingMapLoader
.void
loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Loads map entries usingMapLoader
whose keys are listed in definedkeys
parameter.RFuture<Void>
loadAllAsync(boolean replaceExistingValues, int parallelism)
Loads all map entries to this Redis map usingMapLoader
.protected RFuture<Void>
loadAllAsync(Iterable<? extends K> keys, boolean replaceExistingValues, int parallelism, Map<K,V> loadedEntires)
RFuture<Void>
loadAllAsync(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Loads map entries usingMapLoader
whose keys are listed in definedkeys
parameter.protected void
loadValue(K key, RPromise<V> result, boolean replaceValue)
<KOut,VOut>
RMapReduce<K,V,KOut,VOut>mapReduce()
ReturnsRMapReduce
object associated with this mapprotected <M> RFuture<M>
mapWriterFuture(RFuture<M> future, MapWriterTask task)
protected <M> RFuture<M>
mapWriterFuture(RFuture<M> future, MapWriterTask task, Function<M,Boolean> condition)
V
merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
RFuture<V>
mergeAsync(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.V
put(K key, V value)
Stores the specifiedvalue
mapped by specifiedkey
.void
putAll(Map<? extends K,? extends V> map)
Stores map entries specified inmap
object in batch mode.void
putAll(Map<? extends K,? extends V> map, int batchSize)
Stores map entries specified inmap
object in batch mode.RFuture<Void>
putAllAsync(Map<? extends K,? extends V> map)
Stores map entries specified inmap
object in batch mode.RFuture<Void>
putAllAsync(Map<? extends K,? extends V> map, int batchSize)
Stores map entries specified inmap
object in batch mode.protected RFuture<Void>
putAllOperationAsync(Map<? extends K,? extends V> map)
RFuture<V>
putAsync(K key, V value)
Stores the specifiedvalue
mapped by specifiedkey
.V
putIfAbsent(K key, V value)
Stores the specifiedvalue
mapped bykey
only if there is no value with specifiedkey
stored before.RFuture<V>
putIfAbsentAsync(K key, V value)
Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.protected RFuture<V>
putIfAbsentOperationAsync(K key, V value)
V
putIfExists(K key, V value)
Stores the specifiedvalue
mapped bykey
only if mapping already exists.RFuture<V>
putIfExistsAsync(K key, V value)
Stores the specifiedvalue
mapped bykey
only if mapping already exists.protected RFuture<V>
putIfExistsOperationAsync(K key, V value)
protected RFuture<V>
putOperationAsync(K key, V value)
Map<K,V>
randomEntries(int count)
Returns random map entries from this map limited bycount
RFuture<Map<K,V>>
randomEntriesAsync(int count)
Returns random map entries from this map limited bycount
Set<K>
randomKeys(int count)
Returns random keys from this map limited bycount
RFuture<Set<K>>
randomKeysAsync(int count)
Returns random keys from this map limited bycount
Set<Map.Entry<K,V>>
readAllEntrySet()
Read all map entries at onceRFuture<Set<Map.Entry<K,V>>>
readAllEntrySetAsync()
Read all map entries at onceSet<K>
readAllKeySet()
Read all keys at onceRFuture<Set<K>>
readAllKeySetAsync()
Read all keys at onceMap<K,V>
readAllMap()
Read all map as local instance at onceRFuture<Map<K,V>>
readAllMapAsync()
Read all map as local instance at onceCollection<V>
readAllValues()
Read all values at onceRFuture<Collection<V>>
readAllValuesAsync()
Read all values at oncelong
remainTimeToLive()
Remaining time to live of Redisson object that has a timeoutRFuture<Long>
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeoutV
remove(Object key)
Removes map entry by specifiedkey
and returns value.boolean
remove(Object key, Object value)
Removes map entry only if it exists with specifiedkey
andvalue
.RFuture<Boolean>
removeAsync(Object key, Object value)
Removes map entry only if it exists with specifiedkey
andvalue
.RFuture<V>
removeAsync(K key)
Removes map entry by specifiedkey
and returns value.protected RFuture<Boolean>
removeOperationAsync(Object key, Object value)
protected RFuture<V>
removeOperationAsync(K key)
V
replace(K key, V value)
Replaces previous value with a newvalue
mapped by specifiedkey
.boolean
replace(K key, V oldValue, V newValue)
Replaces previousoldValue
with anewValue
mapped by specifiedkey
.RFuture<V>
replaceAsync(K key, V value)
Replaces previous value with a newvalue
mapped by specifiedkey
.RFuture<Boolean>
replaceAsync(K key, V oldValue, V newValue)
Replaces previousoldValue
with anewValue
mapped by specifiedkey
.protected RFuture<V>
replaceOperationAsync(K key, V value)
protected RFuture<Boolean>
replaceOperationAsync(K key, V oldValue, V newValue)
ScanResult<Map.Entry<Object,Object>>
scanIterator(String name, RedisClient client, long startPos, String pattern, int count)
RFuture<ScanResult<Map.Entry<Object,Object>>>
scanIteratorAsync(String name, RedisClient client, long startPos, String pattern, int count)
int
size()
RFuture<Integer>
sizeAsync()
Returns size of this mapprotected Iterator<V>
valueIterator(String pattern, int count)
Collection<V>
values()
Returns values collection of this map.Collection<V>
values(int count)
Returns values collection of this map.Collection<V>
values(String keyPattern)
Returns values collection of this map.Collection<V>
values(String keyPattern, int count)
Returns values collection of this map.int
valueSize(K key)
Returns size of value mapped by specifiedkey
in bytesRFuture<Integer>
valueSizeAsync(K key)
Returns size of value mapped by key in bytes-
Methods inherited from class org.redisson.RedissonObject
addListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, deleteAsync, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
forEach, getOrDefault, replaceAll
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
-
-
-
Constructor Detail
-
RedissonMap
public RedissonMap(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options, WriteBehindService writeBehindService)
-
RedissonMap
public RedissonMap(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options, WriteBehindService writeBehindService)
-
-
Method Detail
-
mapReduce
public <KOut,VOut> RMapReduce<K,V,KOut,VOut> mapReduce()
Description copied from interface:RMap
ReturnsRMapReduce
object associated with this map
-
getPermitExpirableSemaphore
public RPermitExpirableSemaphore getPermitExpirableSemaphore(K key)
Description copied from interface:RMap
ReturnsRPermitExpirableSemaphore
instance associated with key- Specified by:
getPermitExpirableSemaphore
in interfaceRMap<K,V>
- Parameters:
key
- - map key- Returns:
- permitExpirableSemaphore
-
getSemaphore
public RSemaphore getSemaphore(K key)
Description copied from interface:RMap
ReturnsRSemaphore
instance associated with key- Specified by:
getSemaphore
in interfaceRMap<K,V>
- Parameters:
key
- - map key- Returns:
- semaphore
-
getCountDownLatch
public RCountDownLatch getCountDownLatch(K key)
Description copied from interface:RMap
ReturnsRCountDownLatch
instance associated with key- Specified by:
getCountDownLatch
in interfaceRMap<K,V>
- Parameters:
key
- - map key- Returns:
- countdownlatch
-
getFairLock
public RLock getFairLock(K key)
Description copied from interface:RMap
ReturnsRLock
instance associated with key- Specified by:
getFairLock
in interfaceRMap<K,V>
- Parameters:
key
- - map key- Returns:
- fairlock
-
getLock
public RLock getLock(K key)
Description copied from interface:RMap
ReturnsRLock
instance associated with key
-
getReadWriteLock
public RReadWriteLock getReadWriteLock(K key)
Description copied from interface:RMap
ReturnsRReadWriteLock
instance associated with key- Specified by:
getReadWriteLock
in interfaceRMap<K,V>
- Parameters:
key
- - map key- Returns:
- readWriteLock
-
merge
public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
-
mergeAsync
public RFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
Description copied from interface:RMapAsync
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
.- Specified by:
mergeAsync
in interfaceRMapAsync<K,V>
- 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
null
if no value associated with the key
-
computeAsync
public RFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Description copied from interface:RMapAsync
Computes a new mapping for the specified key and its current mapped value.- Specified by:
computeAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyremappingFunction
- - function to compute a value- Returns:
- the new value associated with the specified key, or
null
if none
-
computeIfAbsentAsync
public RFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction)
Description copied from interface:RMapAsync
Computes a mapping for the specified key if it's not mapped before.- Specified by:
computeIfAbsentAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keymappingFunction
- - function to compute a value- Returns:
- current or new computed value associated with
the specified key, or
null
if the computed value is null
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- Specified by:
computeIfAbsent
in interfaceConcurrentMap<K,V>
- Specified by:
computeIfAbsent
in interfaceMap<K,V>
-
computeIfPresentAsync
public RFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Description copied from interface:RMapAsync
Computes a mapping for the specified key only if it's already mapped.- Specified by:
computeIfPresentAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyremappingFunction
- - function to compute a value- Returns:
- the new value associated with the specified key, or null if none
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- Specified by:
computeIfPresent
in interfaceConcurrentMap<K,V>
- Specified by:
computeIfPresent
in interfaceMap<K,V>
-
sizeAsync
public RFuture<Integer> sizeAsync()
Description copied from interface:RMapAsync
Returns size of this map
-
valueSize
public int valueSize(K key)
Description copied from interface:RMap
Returns size of value mapped by specifiedkey
in bytes
-
valueSizeAsync
public RFuture<Integer> valueSizeAsync(K key)
Description copied from interface:RMapAsync
Returns size of value mapped by key in bytes- Specified by:
valueSizeAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map key- Returns:
- size of value
-
checkKey
protected void checkKey(Object key)
-
containsKey
public boolean containsKey(Object key)
Description copied from interface:RMap
Returnstrue
if this map contains map entry mapped by specifiedkey
, otherwisefalse
- Specified by:
containsKey
in interfaceMap<K,V>
- Specified by:
containsKey
in interfaceRMap<K,V>
- Parameters:
key
- - map key- Returns:
true
if this map contains map entry mapped by specifiedkey
, otherwisefalse
-
containsKeyAsync
public RFuture<Boolean> containsKeyAsync(Object key)
Description copied from interface:RMapAsync
Returnstrue
if this map contains map entry mapped by specifiedkey
, otherwisefalse
- Specified by:
containsKeyAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map key- Returns:
true
if this map contains map entry mapped by specifiedkey
, otherwisefalse
-
containsValue
public boolean containsValue(Object value)
Description copied from interface:RMap
Returnstrue
if this map contains any map entry with specifiedvalue
, otherwisefalse
- Specified by:
containsValue
in interfaceMap<K,V>
- Specified by:
containsValue
in interfaceRMap<K,V>
- Parameters:
value
- - map value- Returns:
true
if this map contains any map entry with specifiedvalue
, otherwisefalse
-
containsValueAsync
public RFuture<Boolean> containsValueAsync(Object value)
Description copied from interface:RMapAsync
Returnstrue
if this map contains any map entry with specifiedvalue
, otherwisefalse
- Specified by:
containsValueAsync
in interfaceRMapAsync<K,V>
- Parameters:
value
- - map value- Returns:
true
if this map contains any map entry with specifiedvalue
, otherwisefalse
-
getAll
public Map<K,V> getAll(Set<K> keys)
Description copied from interface:RMap
Returns map slice contained the mappings with definedkeys
.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.
-
randomKeys
public Set<K> randomKeys(int count)
Description copied from interface:RMap
Returns random keys from this map limited bycount
- Specified by:
randomKeys
in interfaceRMap<K,V>
- Parameters:
count
- - keys amount to return- Returns:
- random keys
-
randomEntries
public Map<K,V> randomEntries(int count)
Description copied from interface:RMap
Returns random map entries from this map limited bycount
- Specified by:
randomEntries
in interfaceRMap<K,V>
- Parameters:
count
- - entries amount to return- Returns:
- random entries
-
randomKeysAsync
public RFuture<Set<K>> randomKeysAsync(int count)
Description copied from interface:RMapAsync
Returns random keys from this map limited bycount
- Specified by:
randomKeysAsync
in interfaceRMapAsync<K,V>
- Parameters:
count
- - keys amount to return- Returns:
- random keys
-
randomEntriesAsync
public RFuture<Map<K,V>> randomEntriesAsync(int count)
Description copied from interface:RMapAsync
Returns random map entries from this map limited bycount
- Specified by:
randomEntriesAsync
in interfaceRMapAsync<K,V>
- Parameters:
count
- - entries amount to return- Returns:
- random entries
-
getAllAsync
public RFuture<Map<K,V>> getAllAsync(Set<K> keys)
Description copied from interface:RMapAsync
Returns map slice contained the mappings with definedkeys
.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.
- Specified by:
getAllAsync
in interfaceRMapAsync<K,V>
- Parameters:
keys
- - map keys- Returns:
- Map slice
-
hasNoLoader
protected boolean hasNoLoader()
-
get
public V get(Object key)
Description copied from interface:RMap
Returns the value mapped by definedkey
ornull
if value is absent.If map doesn't contain value for specified key and
MapLoader
is defined then value will be loaded in read-through mode.
-
put
public V put(K key, V value)
Description copied from interface:RMap
Stores the specifiedvalue
mapped by specifiedkey
. Returns previous value if map entry with specifiedkey
already existed.If
MapWriter
is defined then map entry is stored in write-through mode.
-
remove
public V remove(Object key)
Description copied from interface:RMap
Removes map entry by specifiedkey
and returns value.If
MapWriter
is defined thenkey
is deleted in write-through mode.
-
putAll
public final void putAll(Map<? extends K,? extends V> map)
Description copied from interface:RMap
Stores map entries specified inmap
object in batch mode.If
MapWriter
is defined then map entries will be stored in write-through mode.
-
putAll
public void putAll(Map<? extends K,? extends V> map, int batchSize)
Description copied from interface:RMap
Stores map entries specified inmap
object in batch mode. Batch inserted by chunks limited bybatchSize
value to avoid OOM and/or Redis response timeout error for map with big size.If
MapWriter
is defined then map entries are stored in write-through mode.
-
putAllAsync
public RFuture<Void> putAllAsync(Map<? extends K,? extends V> map, int batchSize)
Description copied from interface:RMapAsync
Stores map entries specified inmap
object in batch mode. Batch inserted by chunks limited bybatchSize
value to avoid OOM and/or Redis response timeout error for map with big size.If
MapWriter
is defined then map entries are stored in write-through mode.- Specified by:
putAllAsync
in interfaceRMapAsync<K,V>
- Parameters:
map
- mappings to be stored in this mapbatchSize
- - size of map entries batch- Returns:
- void
-
putAllAsync
public final RFuture<Void> putAllAsync(Map<? extends K,? extends V> map)
Description copied from interface:RMapAsync
Stores map entries specified inmap
object in batch mode.If
MapWriter
is defined then map entries will be stored in write-through mode.- Specified by:
putAllAsync
in interfaceRMapAsync<K,V>
- Parameters:
map
- mappings to be stored in this map- Returns:
- void
-
mapWriterFuture
protected final <M> RFuture<M> mapWriterFuture(RFuture<M> future, MapWriterTask task)
-
mapWriterFuture
protected final <M> RFuture<M> mapWriterFuture(RFuture<M> future, MapWriterTask task, Function<M,Boolean> condition)
-
putAllOperationAsync
protected RFuture<Void> putAllOperationAsync(Map<? extends K,? extends V> map)
-
keySet
public Set<K> keySet()
Description copied from interface:RMap
Returns key set of this map. Keys are loaded in batch. Batch size is10
.
-
keySet
public Set<K> keySet(String pattern)
Description copied from interface:RMap
Returns key set of this map. Ifpattern
is not null then only keys match this pattern are loaded.Use
org.redisson.client.codec.StringCodec
for 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
- Specified by:
keySet
in interfaceRMap<K,V>
- Parameters:
pattern
- - key pattern- Returns:
- key set
- See Also:
RMap.readAllKeySet()
-
keySet
public Set<K> keySet(String pattern, int count)
Description copied from interface:RMap
Returns 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.Use
org.redisson.client.codec.StringCodec
for 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
- Specified by:
keySet
in interfaceRMap<K,V>
- Parameters:
pattern
- - key patterncount
- - size of keys batch- Returns:
- key set
- See Also:
RMap.readAllKeySet()
-
keySet
public Set<K> keySet(int count)
Description copied from interface:RMap
Returns key set of this map. Keys are loaded in batch. Batch size is defined bycount
param.- Specified by:
keySet
in interfaceRMap<K,V>
- Parameters:
count
- - size of keys batch- Returns:
- key set
- See Also:
RMap.readAllKeySet()
-
values
public Collection<V> values()
Description copied from interface:RMap
Returns values collection of this map. Values are loaded in batch. Batch size is10
.
-
values
public Collection<V> values(String keyPattern, int count)
Description copied from interface:RMap
Returns 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.Use
org.redisson.client.codec.StringCodec
for 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
- Specified by:
values
in interfaceRMap<K,V>
- Parameters:
keyPattern
- - key patterncount
- - size of values batch- Returns:
- values collection
- See Also:
RMap.readAllValues()
-
values
public Collection<V> values(String keyPattern)
Description copied from interface:RMap
Returns 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.Use
org.redisson.client.codec.StringCodec
for 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
- Specified by:
values
in interfaceRMap<K,V>
- Parameters:
keyPattern
- - key pattern- Returns:
- values collection
- See Also:
RMap.readAllValues()
-
values
public Collection<V> values(int count)
Description copied from interface:RMap
Returns values collection of this map. Values are loaded in batch. Batch size is defined bycount
param.- Specified by:
values
in interfaceRMap<K,V>
- Parameters:
count
- - size of values batch- Returns:
- values collection
- See Also:
RMap.readAllValues()
-
entrySet
public Set<Map.Entry<K,V>> entrySet()
Description copied from interface:RMap
Returns map entries collection. Map entries are loaded in batch. Batch size is10
.
-
entrySet
public Set<Map.Entry<K,V>> entrySet(String keyPattern)
Description copied from interface:RMap
Returns 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
- Specified by:
entrySet
in interfaceRMap<K,V>
- Parameters:
keyPattern
- - key pattern- Returns:
- map entries collection
- See Also:
RMap.readAllEntrySet()
-
entrySet
public Set<Map.Entry<K,V>> entrySet(String keyPattern, int count)
Description copied from interface:RMap
Returns 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
- Specified by:
entrySet
in interfaceRMap<K,V>
- Parameters:
keyPattern
- - key patterncount
- - size of entries batch- Returns:
- map entries collection
- See Also:
RMap.readAllEntrySet()
-
entrySet
public Set<Map.Entry<K,V>> entrySet(int count)
Description copied from interface:RMap
Returns map entries collection. Map entries are loaded in batch. Batch size is defined bycount
param.- Specified by:
entrySet
in interfaceRMap<K,V>
- Parameters:
count
- - size of entries batch- Returns:
- map entries collection
- See Also:
RMap.readAllEntrySet()
-
readAllKeySet
public Set<K> readAllKeySet()
Description copied from interface:RMap
Read all keys at once- Specified by:
readAllKeySet
in interfaceRMap<K,V>
- Returns:
- keys
-
readAllKeySetAsync
public RFuture<Set<K>> readAllKeySetAsync()
Description copied from interface:RMapAsync
Read all keys at once- Specified by:
readAllKeySetAsync
in interfaceRMapAsync<K,V>
- Returns:
- keys
-
readAllValues
public Collection<V> readAllValues()
Description copied from interface:RMap
Read all values at once- Specified by:
readAllValues
in interfaceRMap<K,V>
- Returns:
- values
-
readAllValuesAsync
public RFuture<Collection<V>> readAllValuesAsync()
Description copied from interface:RMapAsync
Read all values at once- Specified by:
readAllValuesAsync
in interfaceRMapAsync<K,V>
- Returns:
- values
-
readAllEntrySet
public Set<Map.Entry<K,V>> readAllEntrySet()
Description copied from interface:RMap
Read all map entries at once- Specified by:
readAllEntrySet
in interfaceRMap<K,V>
- Returns:
- entries
-
readAllEntrySetAsync
public RFuture<Set<Map.Entry<K,V>>> readAllEntrySetAsync()
Description copied from interface:RMapAsync
Read all map entries at once- Specified by:
readAllEntrySetAsync
in interfaceRMapAsync<K,V>
- Returns:
- entries
-
readAllMap
public Map<K,V> readAllMap()
Description copied from interface:RMap
Read all map as local instance at once- Specified by:
readAllMap
in interfaceRMap<K,V>
- Returns:
- map
-
readAllMapAsync
public RFuture<Map<K,V>> readAllMapAsync()
Description copied from interface:RMapAsync
Read all map as local instance at once- Specified by:
readAllMapAsync
in interfaceRMapAsync<K,V>
- Returns:
- map
-
putIfExists
public V putIfExists(K key, V value)
Description copied from interface:RMap
Stores the specifiedvalue
mapped bykey
only if mapping already exists.If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
putIfExists
in interfaceRMap<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
null
if 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.
-
putIfExistsAsync
public RFuture<V> putIfExistsAsync(K key, V value)
Description copied from interface:RMapAsync
Stores the specifiedvalue
mapped bykey
only if mapping already exists.If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
putIfExistsAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
null
if key is doesn't exists in the hash and value hasn't been set. Previous value if key already exists in the hash and new value has been stored.
-
putIfAbsent
public V putIfAbsent(K key, V value)
Description copied from interface:RMap
Stores the specifiedvalue
mapped bykey
only if there is no value with specifiedkey
stored before.If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,V>
- Specified by:
putIfAbsent
in interfaceMap<K,V>
- Specified by:
putIfAbsent
in interfaceRMap<K,V>
- 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.
-
putIfAbsentAsync
public RFuture<V> putIfAbsentAsync(K key, V value)
Description copied from interface:RMapAsync
Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
putIfAbsentAsync
in interfaceRMapAsync<K,V>
- 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.
-
hasNoWriter
protected boolean hasNoWriter()
-
fastPutIfAbsent
public boolean fastPutIfAbsent(K key, V value)
Description copied from interface:RMap
Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.Returns
true
if key is a new one in the hash and value was set orfalse
if key already exists in the hash and change hasn't been made.Works faster than
but not returning the previous value associated withRMap.putIfAbsent(Object, Object)
key
If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
fastPutIfAbsent
in interfaceRMap<K,V>
- 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.
-
fastPutIfAbsentAsync
public RFuture<Boolean> fastPutIfAbsentAsync(K key, V value)
Description copied from interface:RMapAsync
Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.Returns
true
if key is a new one in the hash and value was set orfalse
if key already exists in the hash and change hasn't been made.Works faster than
but not returning the previous value associated withRMapAsync.putIfAbsentAsync(Object, Object)
key
If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
fastPutIfAbsentAsync
in interfaceRMapAsync<K,V>
- 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.
-
fastPutIfAbsentOperationAsync
protected RFuture<Boolean> fastPutIfAbsentOperationAsync(K key, V value)
-
fastPutIfExists
public boolean fastPutIfExists(K key, V value)
Description copied from interface:RMap
Stores the specifiedvalue
mapped bykey
only if mapping already exists.Returns
true
if key is a new one in the hash and value was set orfalse
if key already exists in the hash and change hasn't been made.Works faster than
but doesn't return previous value associated withRMap.putIfExists(Object, Object)
key
If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
fastPutIfExists
in interfaceRMap<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if key already exists in the hash and new value has been stored.false
if key doesn't exist in the hash and value hasn't been set.
-
fastPutIfExistsAsync
public RFuture<Boolean> fastPutIfExistsAsync(K key, V value)
Description copied from interface:RMapAsync
Stores the specifiedvalue
mapped bykey
only if mapping already exists.Returns
true
if key is a new one in the hash and value was set orfalse
if key already exists in the hash and change hasn't been made.Works faster than
but doesn't return previous value associated withRMapAsync.putIfExistsAsync(Object, Object)
key
If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
fastPutIfExistsAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if key already exists in the hash and new value has been stored.false
if key doesn't exist in the hash and value hasn't been set.
-
fastPutIfExistsOperationAsync
protected RFuture<Boolean> fastPutIfExistsOperationAsync(K key, V value)
-
remove
public boolean remove(Object key, Object value)
Description copied from interface:RMap
Removes map entry only if it exists with specifiedkey
andvalue
.If
MapWriter
is defined thenkey
is deleted in write-through mode.
-
removeAsync
public RFuture<Boolean> removeAsync(Object key, Object value)
Description copied from interface:RMapAsync
Removes map entry only if it exists with specifiedkey
andvalue
.If
MapWriter
is defined thenkey
is deleted in write-through mode.- Specified by:
removeAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if map entry has been removed otherwisefalse
.
-
checkValue
protected void checkValue(Object value)
-
replace
public boolean replace(K key, V oldValue, V newValue)
Description copied from interface:RMap
Replaces previousoldValue
with anewValue
mapped by specifiedkey
. Returnsfalse
if previous value doesn't exist or equal tooldValue
.If
MapWriter
is defined thennewValue
is written in write-through mode.
-
replaceAsync
public RFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
Description copied from interface:RMapAsync
Replaces previousoldValue
with anewValue
mapped by specifiedkey
. Returnsfalse
if previous value doesn't exist or equal tooldValue
.If
MapWriter
is defined thennewValue
is written in write-through mode.- Specified by:
replaceAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyoldValue
- - map old valuenewValue
- - map new value- Returns:
true
if value has been replaced otherwisefalse
.
-
replaceOperationAsync
protected RFuture<Boolean> replaceOperationAsync(K key, V oldValue, V newValue)
-
replace
public V replace(K key, V value)
Description copied from interface:RMap
Replaces previous value with a newvalue
mapped by specifiedkey
. Returnsnull
if there is no map entry stored before and doesn't store new map entry.If
MapWriter
is defined then newvalue
is written in write-through mode.- Specified by:
replace
in interfaceConcurrentMap<K,V>
- Specified by:
replace
in interfaceMap<K,V>
- Specified by:
replace
in interfaceRMap<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
- previous associated value
or
null
if there is no map entry stored before and doesn't store new map entry
-
replaceAsync
public RFuture<V> replaceAsync(K key, V value)
Description copied from interface:RMapAsync
Replaces previous value with a newvalue
mapped by specifiedkey
. Returnsnull
if there is no map entry stored before and doesn't store new map entry.If
MapWriter
is defined then newvalue
is written in write-through mode.- Specified by:
replaceAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
- previous associated value
or
null
if there is no map entry stored before and doesn't store new map entry
-
fastReplace
public boolean fastReplace(K key, V value)
Description copied from interface:RMap
Replaces previous value with a newvalue
mapped by specifiedkey
.Works faster than
but not returning the previous value.RMap.replace(Object, Object)
Returns
true
if key exists and value was updated orfalse
if key doesn't exists and value wasn't updated.If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
fastReplace
in interfaceRMap<K,V>
- 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.
-
fastReplaceAsync
public RFuture<Boolean> fastReplaceAsync(K key, V value)
Description copied from interface:RMapAsync
Replaces previous value with a newvalue
mapped by specifiedkey
.Works faster than
but not returning the previous value.RMapAsync.replaceAsync(Object, Object)
Returns
true
if key exists and value was updated orfalse
if key doesn't exists and value wasn't updated.If
MapWriter
is defined then new map entry is stored in write-through mode.- Specified by:
fastReplaceAsync
in interfaceRMapAsync<K,V>
- 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.
-
getAsync
public RFuture<V> getAsync(K key)
Description copied from interface:RMapAsync
Returns the value mapped by definedkey
ornull
if value is absent.If map doesn't contain value for specified key and
MapLoader
is defined then value will be loaded in read-through mode.
-
loadAll
public void loadAll(boolean replaceExistingValues, int parallelism)
Description copied from interface:RMap
Loads all map entries to this Redis map usingMapLoader
.
-
loadAllAsync
public RFuture<Void> loadAllAsync(boolean replaceExistingValues, int parallelism)
Description copied from interface:RMapAsync
Loads all map entries to this Redis map usingMapLoader
.- Specified by:
loadAllAsync
in interfaceRMapAsync<K,V>
- Parameters:
replaceExistingValues
- -true
if existed values should be replaced,false
otherwise.parallelism
- - parallelism level, used to increase speed of process execution- Returns:
- void
-
loadAll
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Description copied from interface:RMap
Loads map entries usingMapLoader
whose keys are listed in definedkeys
parameter.
-
loadAllAsync
public RFuture<Void> loadAllAsync(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
Description copied from interface:RMapAsync
Loads map entries usingMapLoader
whose keys are listed in definedkeys
parameter.- Specified by:
loadAllAsync
in interfaceRMapAsync<K,V>
- 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
-
loadAllAsync
protected RFuture<Void> loadAllAsync(Iterable<? extends K> keys, boolean replaceExistingValues, int parallelism, Map<K,V> loadedEntires)
-
putAsync
public RFuture<V> putAsync(K key, V value)
Description copied from interface:RMapAsync
Stores the specifiedvalue
mapped by specifiedkey
. Returns previous value if map entry with specifiedkey
already existed.If
MapWriter
is defined then map entry is stored in write-through mode.
-
removeAsync
public RFuture<V> removeAsync(K key)
Description copied from interface:RMapAsync
Removes map entry by specifiedkey
and returns value.If
MapWriter
is defined thenkey
is deleted in write-through mode.- Specified by:
removeAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map key- Returns:
- deleted value,
null
if map entry doesn't exist
-
fastPutAsync
public RFuture<Boolean> fastPutAsync(K key, V value)
Description copied from interface:RMapAsync
Stores the specifiedvalue
mapped by specifiedkey
.Works faster than
but not returning previous value.RMapAsync.putAsync(Object, Object)
Returns
true
if key is a new key in the hash and value was set orfalse
if key already exists in the hash and the value was updated.If
MapWriter
is defined then map entry is stored in write-through mode.- Specified by:
fastPutAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if key is a new key in the hash and value was set.false
if key already exists in the hash and the value was updated.
-
fastPut
public boolean fastPut(K key, V value)
Description copied from interface:RMap
Stores the specifiedvalue
mapped by specifiedkey
.Works faster than
but not returning previous value.RMap.put(Object, Object)
Returns
true
if key is a new key in the hash and value was set orfalse
if key already exists in the hash and the value was updated.If
MapWriter
is defined then map entry is stored in write-through mode.
-
fastRemoveAsync
public RFuture<Long> fastRemoveAsync(K... keys)
Description copied from interface:RMapAsync
Removes map entries mapped by specifiedkeys
.Works faster than
but not returning the value.RMapAsync.removeAsync(Object)
If
MapWriter
is defined thenkeys
are deleted in write-through mode.- Specified by:
fastRemoveAsync
in interfaceRMapAsync<K,V>
- Parameters:
keys
- - map keys- Returns:
- the number of keys that were removed from the hash, not including specified but non existing keys
-
fastRemoveOperationBatchAsync
protected RFuture<List<Long>> fastRemoveOperationBatchAsync(K... keys)
-
fastRemove
public long fastRemove(K... keys)
Description copied from interface:RMap
Removes map entries mapped by specifiedkeys
.Works faster than
but not returning the value.RMap.remove(Object)
If
MapWriter
is defined thenkeys
are deleted in write-through mode.- Specified by:
fastRemove
in interfaceRMap<K,V>
- Parameters:
keys
- - map keys- Returns:
- the number of keys that were removed from the hash, not including specified but non existing keys
-
scanIterator
public ScanResult<Map.Entry<Object,Object>> scanIterator(String name, RedisClient client, long startPos, String pattern, int count)
-
scanIteratorAsync
public RFuture<ScanResult<Map.Entry<Object,Object>>> scanIteratorAsync(String name, RedisClient client, long startPos, String pattern, int count)
-
addAndGet
public V addAndGet(K key, Number value)
Description copied from interface:RMap
Adds the givendelta
to the current value by mappedkey
. Works only for numeric values!
-
addAndGetAsync
public RFuture<V> addAndGetAsync(K key, Number value)
Description copied from interface:RMapAsync
Adds the givendelta
to the current value by mappedkey
. Works only for numeric values!- Specified by:
addAndGetAsync
in interfaceRMapAsync<K,V>
- Parameters:
key
- - map keyvalue
- the value to add- Returns:
- the updated value
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
expire
public boolean expire(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirable
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirableAsync
Set a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(long timestamp)
Description copied from interface:RExpirable
UseRExpirable.expire(Instant)
instead- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(long timestamp)
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expire
public boolean expire(Instant instant)
Description copied from interface:RExpirable
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
instant
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
public RFuture<Boolean> expireAsync(Instant instant)
Description copied from interface:RExpirableAsync
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
instant
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(Date timestamp)
Description copied from interface:RExpirable
UseRExpirable.expire(Instant)
instead- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(Date timestamp)
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
clearExpire
public boolean clearExpire()
Description copied from interface:RExpirable
Clear an expire timeout or expire date for object.- Specified by:
clearExpire
in interfaceRExpirable
- Returns:
true
if timeout was removedfalse
if object does not exist or does not have an associated timeout
-
clearExpireAsync
public RFuture<Boolean> clearExpireAsync()
Description copied from interface:RExpirableAsync
Clear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsync
in interfaceRExpirableAsync
- Returns:
true
if the timeout was cleared andfalse
if not
-
remainTimeToLive
public long remainTimeToLive()
Description copied from interface:RExpirable
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLive
in interfaceRExpirable
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
remainTimeToLiveAsync
public RFuture<Long> remainTimeToLiveAsync()
Description copied from interface:RExpirableAsync
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsync
in interfaceRExpirableAsync
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
expireAsync
protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
-
-