Class RedissonLocalCachedMap<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,
,V> Map<K,
,V> RDestroyable
,RExpirable
,RExpirableAsync
,RLocalCachedMap<K,
,V> RMap<K,
,V> RMapAsync<K,
,V> RObject
,RObjectAsync
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
Constructor Summary
ConstructorDescriptionRedissonLocalCachedMap
(Codec codec, CommandAsyncExecutor connectionManager, String name, LocalCachedMapOptions<K, V> options, EvictionScheduler evictionScheduler, RedissonClient redisson, WriteBehindService writeBehindService) RedissonLocalCachedMap
(CommandAsyncExecutor commandExecutor, String name, LocalCachedMapOptions<K, V> options, EvictionScheduler evictionScheduler, RedissonClient redisson, WriteBehindService writeBehindService) -
Method Summary
Modifier and TypeMethodDescriptionaddAndGetOperationAsync
(K key, Number value) int
addListener
(ObjectListener listener) Adds object event listeneraddListenerAsync
(ObjectListener listener) Adds object event listenerReturns all map entries stored in local cacheReturns all keys stored in local cacheReturns all values stored in local cacheboolean
Clear an expire timeout or expire date for object.Clear an expire timeout or expire date for object in async mode.clearExpireAsync
(String... keys) void
Clears local cache across all instancesClears local cache across all instancescontainsKeyAsync
(Object key) Returnstrue
if this map contains map entry mapped by specifiedkey
, otherwisefalse
containsValueAsync
(Object value) Returnstrue
if this map contains any map entry with specifiedvalue
, otherwisefalse
protected io.netty.buffer.ByteBuf
createSyncMessage
(io.netty.buffer.ByteBuf mapKey, io.netty.buffer.ByteBuf mapValue, CacheKey cacheKey) Delete object in async modevoid
destroy()
Destroys object when it's not necessary anymore.io.netty.buffer.ByteBuf
Returns map entries collection.boolean
UseRExpirable.expire(Duration)
insteadboolean
Sets a timeout for this object.boolean
Sets an expiration date for this object.expireAsync
(long timeToLive, TimeUnit timeUnit) UseRExpirableAsync.expireAsync(Duration)
insteadexpireAsync
(long timeToLive, TimeUnit timeUnit, String param, String... keys) expireAsync
(Duration duration) Set a timeout for object.expireAsync
(Instant instant) Set an expire date for object.boolean
expireAt
(long timestamp) UseRExpirable.expire(Instant)
insteadboolean
UseRExpirable.expire(Instant)
insteadexpireAtAsync
(long timestamp) UseRExpirableAsync.expireAsync(Instant)
insteadexpireAtAsync
(long timestamp, String param, String... keys) expireAtAsync
(Date timestamp) UseRExpirableAsync.expireAsync(Instant)
insteadboolean
expireIfGreater
(Duration duration) Sets a timeout for this object only if it's greater than timeout set before.boolean
expireIfGreater
(Instant time) Sets an expiration date for this object only if it's greater than expiration date set before.expireIfGreaterAsync
(Duration duration) Sets a timeout for this object only if it's greater than timeout set before.expireIfGreaterAsync
(Instant time) Sets an expiration date for this object only if it's greater than expiration date set before.boolean
expireIfLess
(Duration duration) Sets a timeout for this object only if it's less than timeout set before.boolean
expireIfLess
(Instant time) Sets an expiration date for this object only if it's less than expiration date set before.expireIfLessAsync
(Duration duration) Sets a timeout for this object only if it's less than timeout set before.expireIfLessAsync
(Instant time) Sets an expiration date for this object only if it's less than expiration date set before.boolean
expireIfNotSet
(Duration duration) Sets a timeout for this object only if it hasn't been set before.boolean
expireIfNotSet
(Instant time) Sets an expiration date for this object only if it hasn't been set before.expireIfNotSetAsync
(Duration duration) Sets a timeout for this object only if it hasn't been set before.expireIfNotSetAsync
(Instant time) Sets an expiration date for this object only if it hasn't been set before.boolean
expireIfSet
(Duration duration) Sets a timeout for this object only if it has been already set.boolean
expireIfSet
(Instant time) Sets an expiration date for this object only if it has been already set.expireIfSetAsync
(Duration duration) Sets a timeout for this object only if it has been already set.expireIfSetAsync
(Instant time) Sets an expiration date for this object only if it has been already set.fastPutIfAbsentAsync
(K key, V value) Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.fastPutIfExistsAsync
(K key, V value) Stores the specifiedvalue
mapped bykey
only if mapping already exists.fastPutOperationAsync
(K key, V value) fastRemoveOperationAsync
(K... keys) fastRemoveOperationBatchAsync
(K... keys) fastReplaceAsync
(K key, V value) Replaces previous value with a newvalue
mapped by specifiedkey
.fastReplaceOperationAsync
(K key, V value) protected byte[]
generateLogEntryId
(byte[] keyHash) getAllAsync
(Set<K> keys) Returns map slice contained the mappings with definedkeys
.Returns state of local cachelong
Expiration time of Redisson object that has a timeoutExpiration time of Redisson object that has a timeoutReturns key set of this map.void
Pre-warm the cached entries.void
preloadCache
(int count) Pre-warm the cached entries.putAllOperationAsync
(Map<? extends K, ? extends V> map) putIfAbsentAsync
(K key, V value) Stores the specifiedvalue
mapped by specifiedkey
only if there is no value with specifiedkey
stored before.putIfExistsAsync
(K key, V value) Stores the specifiedvalue
mapped bykey
only if mapping already exists.putOperationAsync
(K key, V value) Read all map entries at onceRead all map as local instance at onceRead all values at oncelong
Remaining time to live of Redisson object that has a timeoutRemaining time to live of Redisson object that has a timeoutremoveAsync
(Object key, Object value) Removes map entry only if it exists with specifiedkey
andvalue
.void
removeListener
(int listenerId) Removes object event listenerremoveListenerAsync
(int listenerId) Removes object event listenerremoveOperationAsync
(Object key, Object value) removeOperationAsync
(K key) replaceAsync
(K key, V value) Replaces previous value with a newvalue
mapped by specifiedkey
.replaceAsync
(K key, V oldValue, V newValue) Replaces previousoldValue
with anewValue
mapped by specifiedkey
.replaceOperationAsync
(K key, V value) replaceOperationAsync
(K key, V oldValue, V newValue) Returns size of this mapReturns bytes amount used by object in Redis memory.Returns values collection of this map.Methods inherited from class org.redisson.RedissonMap
addAndGet, addAndGetAsync, checkKey, checkValue, clear, clearAsync, compute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, containsKey, containsKeyAsync, containsKeyOperationAsync, containsValue, encodeMapKeys, entryIterator, entrySet, entrySet, entrySet, equals, fastPut, fastPutAsync, fastPutIfAbsent, fastPutIfAbsentOperationAsync, fastPutIfExists, fastPutIfExistsOperationAsync, fastRemove, fastRemoveAsync, fastReplace, get, getAll, getAllOperationAsync, getAsync, getCountDownLatch, getFairLock, getLock, getOperationAsync, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, hashCode, hasNoLoader, hasNoWriter, isEmpty, keyIterator, keySet, keySet, keySet, loadAll, loadAll, loadAllAsync, loadAllAsync, loadAllMapAsync, loadValue, loadValue, mapReduce, mapWriterFuture, mapWriterFuture, merge, mergeAsync, put, putAll, putAll, putAllAsync, putAllAsync, putAsync, putIfAbsent, putIfAbsentOperationAsync, putIfExists, putIfExistsOperationAsync, randomEntries, randomEntriesAsync, randomKeys, randomKeysAsync, readAllEntrySet, readAllKeySet, readAllKeySetAsync, readAllMap, readAllValues, remove, remove, removeAsync, replace, replace, scanIterator, scanIteratorAsync, scanKeyIterator, scanKeyIteratorAsync, size, valueIterator, values, values, values, valueSize, valueSizeAsync
Methods inherited from class org.redisson.RedissonObject
addListener, addListenerAsync, addTrackingListener, addTrackingListenerAsync, checkNotBatch, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, getServiceManager, getSubscribeService, isExists, isExistsAsync, map, mapName, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenerAsync, removeTrackingListener, removeTrackingListenerAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, 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
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLive
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsync
Methods inherited from interface org.redisson.api.RMap
addAndGet, containsKey, containsValue, entrySet, entrySet, entrySet, fastPut, fastPutIfAbsent, fastPutIfExists, fastRemove, fastReplace, get, getAll, getCountDownLatch, getFairLock, getLock, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, keySet, keySet, keySet, loadAll, loadAll, mapReduce, put, putAll, putAll, putIfAbsent, putIfExists, randomEntries, randomKeys, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, replace, replace, values, values, values, valueSize
Methods inherited from interface org.redisson.api.RMapAsync
addAndGetAsync, clearAsync, computeAsync, computeIfAbsentAsync, computeIfPresentAsync, fastPutAsync, fastRemoveAsync, getAsync, loadAllAsync, loadAllAsync, mergeAsync, putAllAsync, putAllAsync, putAsync, randomEntriesAsync, randomKeysAsync, readAllKeySetAsync, removeAsync, valueSizeAsync
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
-
Field Details
-
TOPIC_SUFFIX
- See Also:
-
DISABLED_KEYS_SUFFIX
- See Also:
-
DISABLED_ACK_SUFFIX
- See Also:
-
-
Constructor Details
-
RedissonLocalCachedMap
public RedissonLocalCachedMap(CommandAsyncExecutor commandExecutor, String name, LocalCachedMapOptions<K, V> options, EvictionScheduler evictionScheduler, RedissonClient redisson, WriteBehindService writeBehindService) -
RedissonLocalCachedMap
public RedissonLocalCachedMap(Codec codec, CommandAsyncExecutor connectionManager, String name, LocalCachedMapOptions<K, V> options, EvictionScheduler evictionScheduler, RedissonClient redisson, WriteBehindService writeBehindService)
-
-
Method Details
-
getLocalCacheView
-
sizeAsync
Description copied from interface:RMapAsync
Returns size of this map -
containsKeyAsync
Description copied from interface:RMapAsync
Returnstrue
if this map contains map entry mapped by specifiedkey
, otherwisefalse
- Specified by:
containsKeyAsync
in interfaceRMapAsync<K,
V> - Overrides:
containsKeyAsync
in classRedissonMap<K,
V> - Parameters:
key
- - map key- Returns:
true
if this map contains map entry mapped by specifiedkey
, otherwisefalse
-
containsValueAsync
Description copied from interface:RMapAsync
Returnstrue
if this map contains any map entry with specifiedvalue
, otherwisefalse
- Specified by:
containsValueAsync
in interfaceRMapAsync<K,
V> - Overrides:
containsValueAsync
in classRedissonMap<K,
V> - Parameters:
value
- - map value- Returns:
true
if this map contains any map entry with specifiedvalue
, otherwisefalse
-
getAsync
- Overrides:
getAsync
in classRedissonMap<K,
V>
-
generateLogEntryId
protected byte[] generateLogEntryId(byte[] keyHash) -
putOperationAsync
- Overrides:
putOperationAsync
in classRedissonMap<K,
V>
-
createSyncMessage
protected io.netty.buffer.ByteBuf createSyncMessage(io.netty.buffer.ByteBuf mapKey, io.netty.buffer.ByteBuf mapValue, CacheKey cacheKey) -
fastPutOperationAsync
- Overrides:
fastPutOperationAsync
in classRedissonMap<K,
V>
-
destroy
public void destroy()Description copied from interface:RDestroyable
Destroys object when it's not necessary anymore.- Specified by:
destroy
in interfaceRDestroyable
- Overrides:
destroy
in classRedissonMap<K,
V>
-
removeOperationAsync
- Overrides:
removeOperationAsync
in classRedissonMap<K,
V>
-
fastRemoveOperationBatchAsync
- Overrides:
fastRemoveOperationBatchAsync
in classRedissonMap<K,
V>
-
fastRemoveOperationAsync
- Overrides:
fastRemoveOperationAsync
in classRedissonMap<K,
V>
-
sizeInMemoryAsync
Description copied from interface:RObjectAsync
Returns bytes amount used by object in Redis memory.- Specified by:
sizeInMemoryAsync
in interfaceRObjectAsync
- Overrides:
sizeInMemoryAsync
in classRedissonObject
- Returns:
- size in bytes
-
deleteAsync
Description copied from interface:RObjectAsync
Delete object in async mode- Specified by:
deleteAsync
in interfaceRObjectAsync
- Overrides:
deleteAsync
in classRedissonObject
- Returns:
true
if object was deletedfalse
if not
-
getAllAsync
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> - Overrides:
getAllAsync
in classRedissonMap<K,
V> - Parameters:
keys
- - map keys- Returns:
- Map slice
-
putAllOperationAsync
- Overrides:
putAllOperationAsync
in classRedissonMap<K,
V>
-
addAndGetOperationAsync
- Overrides:
addAndGetOperationAsync
in classRedissonMap<K,
V>
-
fastPutIfAbsentAsync
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> - Overrides:
fastPutIfAbsentAsync
in classRedissonMap<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.
-
fastPutIfExistsAsync
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> - Overrides:
fastPutIfExistsAsync
in classRedissonMap<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.
-
readAllValuesAsync
Description copied from interface:RMapAsync
Read all values at once- Specified by:
readAllValuesAsync
in interfaceRMapAsync<K,
V> - Overrides:
readAllValuesAsync
in classRedissonMap<K,
V> - Returns:
- values
-
readAllMapAsync
Description copied from interface:RMapAsync
Read all map as local instance at once- Specified by:
readAllMapAsync
in interfaceRMapAsync<K,
V> - Overrides:
readAllMapAsync
in classRedissonMap<K,
V> - Returns:
- map
-
preloadCache
public void preloadCache()Description copied from interface:RLocalCachedMap
Pre-warm the cached entries. Not guaranteed to load ALL values, but statistically will preload approximately all (all if no concurrent mutating activity). Entries are loaded in a batch with size of 10 elements.- Specified by:
preloadCache
in interfaceRLocalCachedMap<K,
V>
-
preloadCache
public void preloadCache(int count) Description copied from interface:RLocalCachedMap
Pre-warm the cached entries. Not guaranteed to load ALL values, but statistically will preload approximately all (all if no concurrent mutating activity) Entries are loaded in a batch. Batch size is defined bycount
param.- Specified by:
preloadCache
in interfaceRLocalCachedMap<K,
V> - Parameters:
count
- - size of batch
-
clearLocalCache
public void clearLocalCache()Description copied from interface:RLocalCachedMap
Clears local cache across all instances- Specified by:
clearLocalCache
in interfaceRLocalCachedMap<K,
V>
-
clearLocalCacheAsync
Description copied from interface:RLocalCachedMap
Clears local cache across all instances- Specified by:
clearLocalCacheAsync
in interfaceRLocalCachedMap<K,
V> - Returns:
- void
-
readAllEntrySetAsync
Description copied from interface:RMapAsync
Read all map entries at once- Specified by:
readAllEntrySetAsync
in interfaceRMapAsync<K,
V> - Overrides:
readAllEntrySetAsync
in classRedissonMap<K,
V> - Returns:
- entries
-
fastReplaceAsync
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> - Overrides:
fastReplaceAsync
in classRedissonMap<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.
-
fastReplaceOperationAsync
- Overrides:
fastReplaceOperationAsync
in classRedissonMap<K,
V>
-
replaceOperationAsync
- Overrides:
replaceOperationAsync
in classRedissonMap<K,
V>
-
replaceAsync
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> - Overrides:
replaceAsync
in classRedissonMap<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
-
replaceOperationAsync
- Overrides:
replaceOperationAsync
in classRedissonMap<K,
V>
-
replaceAsync
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> - Overrides:
replaceAsync
in classRedissonMap<K,
V> - Parameters:
key
- - map keyoldValue
- - map old valuenewValue
- - map new value- Returns:
true
if value has been replaced otherwisefalse
.
-
removeOperationAsync
- Overrides:
removeOperationAsync
in classRedissonMap<K,
V>
-
removeAsync
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> - Overrides:
removeAsync
in classRedissonMap<K,
V> - Parameters:
key
- - map keyvalue
- - map value- Returns:
true
if map entry has been removed otherwisefalse
.
-
putIfExistsAsync
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> - Overrides:
putIfExistsAsync
in classRedissonMap<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.
-
putIfAbsentAsync
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> - Overrides:
putIfAbsentAsync
in classRedissonMap<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.
-
encode
- Overrides:
encode
in classRedissonObject
-
cachedKeySet
Description copied from interface:RLocalCachedMap
Returns all keys stored in local cache- Specified by:
cachedKeySet
in interfaceRLocalCachedMap<K,
V> - Returns:
- keys
-
cachedValues
Description copied from interface:RLocalCachedMap
Returns all values stored in local cache- Specified by:
cachedValues
in interfaceRLocalCachedMap<K,
V> - Returns:
- values
-
cachedEntrySet
Description copied from interface:RLocalCachedMap
Returns all map entries stored in local cache- Specified by:
cachedEntrySet
in interfaceRLocalCachedMap<K,
V> - Returns:
- entries
-
getCachedMap
Description copied from interface:RLocalCachedMap
Returns state of local cache- Specified by:
getCachedMap
in interfaceRLocalCachedMap<K,
V> - Returns:
- map
-
keySet
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
-
values
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
-
entrySet
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
-
addListener
Description copied from interface:RObject
Adds object event listener- Specified by:
addListener
in interfaceRLocalCachedMap<K,
V> - Specified by:
addListener
in interfaceRMap<K,
V> - Specified by:
addListener
in interfaceRObject
- Overrides:
addListener
in classRedissonMap<K,
V> - Parameters:
listener
- - object event listener- Returns:
- listener id
- See Also:
-
addListenerAsync
Description copied from interface:RObjectAsync
Adds object event listener- Specified by:
addListenerAsync
in interfaceRMapAsync<K,
V> - Specified by:
addListenerAsync
in interfaceRObjectAsync
- Overrides:
addListenerAsync
in classRedissonMap<K,
V> - Parameters:
listener
- - object event listener- Returns:
- listener id
- See Also:
-
removeListener
public void removeListener(int listenerId) Description copied from interface:RObject
Removes object event listener- Specified by:
removeListener
in interfaceRObject
- Overrides:
removeListener
in classRedissonMap<K,
V> - Parameters:
listenerId
- - listener id
-
removeListenerAsync
Description copied from interface:RObjectAsync
Removes object event listener- Specified by:
removeListenerAsync
in interfaceRObjectAsync
- Overrides:
removeListenerAsync
in classRedissonMap<K,
V> - Parameters:
listenerId
- - listener id
-
expire
Description copied from interface:RExpirable
UseRExpirable.expire(Duration)
instead- 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
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Duration)
instead- 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
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
Description copied from interface:RExpirable
Sets an expiration date for this 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
-
expireIfSet
Description copied from interface:RExpirable
Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSet
Description copied from interface:RExpirable
Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreater
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLess
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
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
-
expire
Description copied from interface:RExpirable
Sets a timeout for this object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
Description copied from interface:RExpirableAsync
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
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
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
-
expireIfSet
Description copied from interface:RExpirable
Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSet
Description copied from interface:RExpirable
Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreater
Description copied from interface:RExpirable
Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLess
Description copied from interface:RExpirable
Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- 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
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
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.
-
getExpireTime
public long getExpireTime()Description copied from interface:RExpirable
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTime
in interfaceRExpirable
- Returns:
- expiration time
-
getExpireTimeAsync
Description copied from interface:RExpirableAsync
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTimeAsync
in interfaceRExpirableAsync
- Returns:
- expiration time
-
expireAsync
-
expireAtAsync
-
clearExpireAsync
-