Class RedissonMapCache<K,V>
- Type Parameters:
K
- keyV
- value
- All Implemented Interfaces:
ConcurrentMap<K,
,V> Map<K,
,V> RDestroyable
,RExpirable
,RExpirableAsync
,RMap<K,
,V> RMapAsync<K,
,V> RMapCache<K,
,V> RMapCacheAsync<K,
,V> RObject
,RObjectAsync
- Direct Known Subclasses:
RedissonTransactionalMapCache
Map-based cache with ability to set TTL for each entry via
put(Object, Object, long, TimeUnit)
or putIfAbsent(Object, Object, long, TimeUnit)
methods.
And therefore has an complex lua-scripts inside.
Current redis implementation doesnt have map entry eviction functionality.
Thus entries are checked for TTL expiration during any key/value/entry read operation.
If key/value/entry expired then it doesn't returns and clean task runs asynchronous.
Clean task deletes removes 100 expired entries at once.
In addition there is EvictionScheduler
. This scheduler
deletes expired entries in time interval between 5 seconds to 2 hours.
If eviction is not required then it's better to use RedissonMap
object.
- Author:
- Nikita Koksharov
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
Constructor Summary
ConstructorDescriptionRedissonMapCache
(Codec codec, EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapCacheOptions<K, V> options, WriteBehindService writeBehindService) RedissonMapCache
(EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapCacheOptions<K, V> options, WriteBehindService writeBehindService) -
Method Summary
Modifier and TypeMethodDescriptionAdds the givendelta
to the current value by mappedkey
.addAndGetOperationAsync
(K key, Number value) int
addListener
(MapEntryListener listener) Adds map entry listeneraddListenerAsync
(MapEntryListener listener) Adds map entry listenervoid
clear()
Clears map without removing options data used during map creation.boolean
Clear an expire timeout or expire date for object.Clear an expire timeout or expire date for object in async mode.clearExpireAsync
(String... keys) containsKeyOperationAsync
(String name, Object key) containsValueAsync
(Object value) Returnstrue
if this map contains any map entry with specifiedvalue
, otherwisefalse
Delete object in async modevoid
destroy()
Destroys object when it's not necessary anymore.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)
insteadint
expireEntries
(Set<K> keys, Duration ttl, Duration maxIdleTime) Updates time to live and max idle time of specified entries by keys.expireEntriesAsync
(Set<K> keys, Duration ttl, Duration maxIdleTime) Updates time to live and max idle time of specified entries by keys.int
expireEntriesIfNotSet
(Set<K> keys, Duration ttl, Duration maxIdleTime) Sets time to live and max idle time of specified entries by keys.expireEntriesIfNotSetAsync
(Set<K> keys, Duration ttl, Duration maxIdleTime) boolean
expireEntry
(K key, Duration ttl, Duration maxIdleTime) Updates time to live and max idle time of specified entry by key.expireEntryAsync
(K key, Duration ttl, Duration maxIdleTime) Updates time to live and max idle time of specified entry by key.boolean
expireEntryIfNotSet
(K key, Duration ttl, Duration maxIdleTime) Sets time to live and max idle time of specified entry by key.expireEntryIfNotSetAsync
(K key, Duration ttl, Duration maxIdleTime) boolean
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.boolean
Stores value mapped by key with specified time to live.boolean
Stores value mapped by key with specified time to live and max idle time.fastPutAsync
(K key, V value, long ttl, TimeUnit ttlUnit) Stores value mapped by key with specified time to live.fastPutAsync
(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Stores value mapped by key with specified time to live and max idle time.boolean
fastPutIfAbsent
(K key, V value, long ttl, TimeUnit ttlUnit) If the specified key is not already associated with a value, associate it with the given value.boolean
fastPutIfAbsent
(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) If the specified key is not already associated with a value, associate it with the given value.fastPutIfAbsentAsync
(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) If the specified key is not already associated with a value, associate it with the given value.fastPutIfAbsentOperationAsync
(K key, V value) fastPutIfExistsOperationAsync
(K key, V value) fastPutOperationAsync
(K key, V value) fastPutOperationAsync
(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) fastRemoveOperationAsync
(K... keys) fastRemoveOperationBatchAsync
(K... keys) fastReplaceOperationAsync
(K key, V value) getAllOperationAsync
(Set<K> keys) getAllWithTTLOnly
(Set<K> keys) Returns map slice contained the mappings with definedkeys
.getAllWithTTLOnlyAsync
(Set<K> keys) Returns map slice contained the mappings with definedkeys
.getAllWithTTLOnlyOperationAsync
(Set<K> keys) long
Expiration time of Redisson object that has a timeoutExpiration time of Redisson object that has a timeoutgetOperationAsync
(K key) protected RTopic
getWithTTLOnly
(K key) Returns the value mapped by definedkey
ornull
if value is absent.getWithTTLOnlyAsync
(K key) Returns the value mapped by definedkey
ornull
if value is absent.Stores value mapped by key with specified time to live.Stores value mapped by key with specified time to live and max idle time.void
Associates the specifiedvalue
with the specifiedkey
in batch.putAllAsync
(Map<? extends K, ? extends V> map, long ttl, TimeUnit ttlUnit) Associates the specifiedvalue
with the specifiedkey
in batch.putAllOperationAsync
(Map<? extends K, ? extends V> map) Stores value mapped by key with specified time to live.Stores value mapped by key with specified time to live and max idle time.putIfAbsent
(K key, V value, long ttl, TimeUnit ttlUnit) If the specified key is not already associated with a value, associate it with the given value.putIfAbsent
(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) If the specified key is not already associated with a value, associate it with the given value.putIfAbsentAsync
(K key, V value, long ttl, TimeUnit ttlUnit) If the specified key is not already associated with a value, associate it with the given value.putIfAbsentAsync
(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) If the specified key is not already associated with a value, associate it with the given value.putIfAbsentOperationAsync
(K key, V value) putIfExistsOperationAsync
(K key, V value) putOperationAsync
(K key, V value) putOperationAsync
(K key, V value, long ttlTimeout, long maxIdleTimeout, long maxIdleDelta, long ttlTimeoutDelta) randomEntriesAsync
(int count) Returns random map entries from this map limited bycount
randomKeysAsync
(int count) Returns random keys from this map limited bycount
Read all map entries at onceRead all keys at onceRead all map as local instance at onceRead all values at oncelong
Remaining time to live of Redisson object that has a timeoutlong
remainTimeToLive
(K key) Remaining time to live of map entry associated with akey
.Remaining time to live of Redisson object that has a timeoutremainTimeToLiveAsync
(K key) Remaining time to live of map entry associated with akey
.void
removeListener
(int listenerId) Removes object event listenerremoveOperationAsync
(Object key, Object value) removeOperationAsync
(K key) replaceOperationAsync
(K key, V value) replaceOperationAsync
(K key, V oldValue, V newValue) scanIteratorAsync
(String name, RedisClient client, long startPos, String pattern, int count) scanKeyIteratorAsync
(String name, RedisClient client, long startPos, String pattern, int count) void
setMaxSize
(int maxSize) Sets max size of the map and overrides current value.void
setMaxSize
(int maxSize, EvictionMode mode) Sets max size of the map and overrides current value.setMaxSizeAsync
(int maxSize) Sets max size of the map and overrides current value.setMaxSizeAsync
(int maxSize, EvictionMode mode) Sets max size of the map and overrides current value.Returns bytes amount used by object in Redis memory.boolean
trySetMaxSize
(int maxSize) Tries to set max size of the map.boolean
trySetMaxSize
(int maxSize, EvictionMode mode) Tries to set max size of the map.trySetMaxSizeAsync
(int maxSize) Tries to set max size of the map.trySetMaxSizeAsync
(int maxSize, EvictionMode mode) Tries to set max size of the map.boolean
updateEntryExpiration
(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) UseRMapCache.expireEntry(Object, Duration, Duration)
instead.updateEntryExpirationAsync
(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Methods inherited from class org.redisson.RedissonMap
addAndGetAsync, addListener, addListenerAsync, checkKey, checkValue, compute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, containsKey, containsKeyAsync, containsKeyAsync, containsValue, encodeMapKeys, entryIterator, entrySet, entrySet, entrySet, entrySet, equals, fastPut, fastPutAsync, fastPutIfAbsent, fastPutIfAbsentAsync, fastPutIfExists, fastPutIfExistsAsync, fastRemove, fastRemoveAsync, fastReplace, fastReplaceAsync, get, getAll, getAllAsync, getAsync, getAsync, getCountDownLatch, getFairLock, getLock, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, hashCode, hasNoLoader, hasNoWriter, isEmpty, keyIterator, keySet, keySet, keySet, keySet, loadAll, loadAll, loadAllAsync, loadAllAsync, loadAllMapAsync, loadValue, loadValue, mapReduce, mapWriterFuture, mapWriterFuture, merge, mergeAsync, put, putAll, putAll, putAllAsync, putAllAsync, putAsync, putIfAbsent, putIfAbsentAsync, putIfExists, putIfExistsAsync, randomEntries, randomKeys, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, removeAsync, removeAsync, replace, replace, replaceAsync, replaceAsync, scanIterator, scanKeyIterator, size, sizeAsync, valueIterator, values, values, values, values, valueSize, valueSizeAsync
Methods inherited from class org.redisson.RedissonObject
addListener, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, getServiceManager, getSubscribeService, isExists, isExistsAsync, map, migrate, migrateAsync, move, moveAsync, prefixName, removeListenerAsync, 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
expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsync
Methods inherited from interface org.redisson.api.RMap
addListener, containsKey, containsValue, entrySet, entrySet, entrySet, entrySet, fastPut, fastPutIfAbsent, fastPutIfExists, fastRemove, fastReplace, get, getAll, getCountDownLatch, getFairLock, getLock, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, keySet, keySet, keySet, keySet, loadAll, loadAll, mapReduce, put, putAll, putAll, putIfAbsent, putIfExists, randomEntries, randomKeys, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, replace, replace, values, values, values, values, valueSize
Methods inherited from interface org.redisson.api.RMapAsync
addAndGetAsync, addListenerAsync, computeAsync, computeIfAbsentAsync, computeIfPresentAsync, containsKeyAsync, fastPutAsync, fastPutIfAbsentAsync, fastPutIfExistsAsync, fastRemoveAsync, fastReplaceAsync, getAllAsync, getAsync, loadAllAsync, loadAllAsync, mergeAsync, putAllAsync, putAllAsync, putAsync, putIfAbsentAsync, putIfExistsAsync, removeAsync, removeAsync, replaceAsync, replaceAsync, valueSizeAsync
Methods inherited from interface org.redisson.api.RMapCacheAsync
sizeAsync
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, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
-
Field Details
-
publishCommand
-
-
Constructor Details
-
RedissonMapCache
public RedissonMapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapCacheOptions<K, V> options, WriteBehindService writeBehindService) -
RedissonMapCache
public RedissonMapCache(Codec codec, EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapCacheOptions<K, V> options, WriteBehindService writeBehindService)
-
-
Method Details
-
trySetMaxSize
public boolean trySetMaxSize(int maxSize) Description copied from interface:RMapCache
Tries to set max size of the map. Superfluous elements are evicted using LRU algorithm.- Specified by:
trySetMaxSize
in interfaceRMapCache<K,
V> - Parameters:
maxSize
- - max size- Returns:
true
if max size has been successfully set, otherwisefalse
. If0
the cache is unbounded (default).
-
trySetMaxSize
Description copied from interface:RMapCache
Tries to set max size of the map. Superfluous elements are evicted using defined algorithm.- Specified by:
trySetMaxSize
in interfaceRMapCache<K,
V> - Parameters:
maxSize
- - max sizemode
- - eviction mode- Returns:
true
if max size has been successfully set, otherwisefalse
.
-
trySetMaxSizeAsync
Description copied from interface:RMapCacheAsync
Tries to set max size of the map. Superfluous elements are evicted using LRU algorithm by default.- Specified by:
trySetMaxSizeAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
maxSize
- - max size- Returns:
true
if max size has been successfully set, otherwisefalse
.
-
trySetMaxSizeAsync
Description copied from interface:RMapCacheAsync
Tries to set max size of the map. Superfluous elements are evicted using defined algorithm.- Specified by:
trySetMaxSizeAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
maxSize
- - max sizemode
- - eviction mode- Returns:
true
if max size has been successfully set, otherwisefalse
.
-
setMaxSize
public void setMaxSize(int maxSize) Description copied from interface:RMapCache
Sets max size of the map and overrides current value. Superfluous elements are evicted using LRU algorithm.- Specified by:
setMaxSize
in interfaceRMapCache<K,
V> - Parameters:
maxSize
- - max size If0
the cache is unbounded (default).
-
setMaxSize
Description copied from interface:RMapCache
Sets max size of the map and overrides current value. Superfluous elements are evicted using defined algorithm.- Specified by:
setMaxSize
in interfaceRMapCache<K,
V> - Parameters:
maxSize
- - max sizemode
- - eviction mode
-
setMaxSizeAsync
Description copied from interface:RMapCacheAsync
Sets max size of the map and overrides current value. Superfluous elements are evicted using LRU algorithm by default.- Specified by:
setMaxSizeAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
maxSize
- - max size- Returns:
- void
-
setMaxSizeAsync
Description copied from interface:RMapCacheAsync
Sets max size of the map and overrides current value. Superfluous elements are evicted using defined algorithm.- Specified by:
setMaxSizeAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
maxSize
- - max sizemode
- - eviction mode- Returns:
- void
-
containsKeyOperationAsync
- Overrides:
containsKeyOperationAsync
in classRedissonMap<K,
V>
-
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
-
getAllOperationAsync
- Overrides:
getAllOperationAsync
in classRedissonMap<K,
V>
-
putIfAbsent
Description copied from interface:RMapCache
If the specified key is not already associated with a value, associate it with the given value.Stores value mapped by key with specified time to live. Entry expires after specified time to live.
- Specified by:
putIfAbsent
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then stores infinitely.ttlUnit
- - time unit- Returns:
- current associated value
-
putIfAbsentAsync
Description copied from interface:RMapCacheAsync
If the specified key is not already associated with a value, associate it with the given value.Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
- Specified by:
putIfAbsentAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then stores infinitely.ttlUnit
- - time unit- Returns:
- previous associated value
-
putIfAbsent
public V putIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCache
If the specified key is not already associated with a value, associate it with the given value.Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
- Specified by:
putIfAbsent
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- current associated value
-
putIfAbsentAsync
public RFuture<V> putIfAbsentAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCacheAsync
If the specified key is not already associated with a value, associate it with the given value.Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
If the map previously contained a mapping for the key, the old value is replaced by the specified value.
- Specified by:
putIfAbsentAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- previous associated value
-
removeOperationAsync
- Overrides:
removeOperationAsync
in classRedissonMap<K,
V>
-
getOperationAsync
- Overrides:
getOperationAsync
in classRedissonMap<K,
V>
-
put
Description copied from interface:RMapCache
Stores value mapped by key with specified time to live. Entry expires after specified time to live.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
-
putOperationAsync
- Overrides:
putOperationAsync
in classRedissonMap<K,
V>
-
putIfExistsOperationAsync
- Overrides:
putIfExistsOperationAsync
in classRedissonMap<K,
V>
-
putIfAbsentOperationAsync
- Overrides:
putIfAbsentOperationAsync
in classRedissonMap<K,
V>
-
putAll
Description copied from interface:RMapCache
Associates the specifiedvalue
with the specifiedkey
in batch.If
MapWriter
is defined then new map entries will be stored in write-through mode. -
putAllAsync
Description copied from interface:RMapCacheAsync
Associates the specifiedvalue
with the specifiedkey
in batch.If
MapWriter
is defined then new map entries are stored in write-through mode.- Specified by:
putAllAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
map
- - mappings to be stored in this mapttl
- - time to live for all key\value entries. If0
then stores infinitely.ttlUnit
- - time unit- Returns:
- void
-
addAndGet
Description copied from interface:RMap
Adds the givendelta
to the current value by mappedkey
.Works only with codecs below
-
addAndGetOperationAsync
- Overrides:
addAndGetOperationAsync
in classRedissonMap<K,
V>
-
fastPut
Description copied from interface:RMapCache
Stores value mapped by key with specified time to live. Entry expires after specified time to live.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual
RMapCache.put(Object, Object, long, TimeUnit)
as it not returns previous value.- Specified by:
fastPut
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then stores infinitely.ttlUnit
- - time unit- 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.
-
fastPutAsync
Description copied from interface:RMapCacheAsync
Stores value mapped by key with specified time to live. Entry expires after specified time to live.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual
RMapCacheAsync.putAsync(Object, Object, long, TimeUnit)
as it not returns previous value.- Specified by:
fastPutAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then stores infinitely.ttlUnit
- - time unit- 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, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCache
Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual
RMapCache.put(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.- Specified by:
fastPut
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- 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.
-
fastPutAsync
public RFuture<Boolean> fastPutAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCacheAsync
Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual
RMapCacheAsync.putAsync(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.- Specified by:
fastPutAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- 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.
-
fastPutOperationAsync
-
updateEntryExpiration
public boolean updateEntryExpiration(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCache
UseRMapCache.expireEntry(Object, Duration, Duration)
instead.- Specified by:
updateEntryExpiration
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyttl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- returns
false
if entry already expired or doesn't exist, otherwise returnstrue
.
-
updateEntryExpirationAsync
public RFuture<Boolean> updateEntryExpirationAsync(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCacheAsync
- Specified by:
updateEntryExpirationAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyttl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- returns
false
if entry already expired or doesn't exist, otherwise returnstrue
.
-
expireEntry
Description copied from interface:RMapCache
Updates time to live and max idle time of specified entry by key. Entry expires when specified time to live or max idle time was reached.Returns
false
if entry already expired or doesn't exist, otherwise returnstrue
.- Specified by:
expireEntry
in interfaceRMapCache<K,
V> - Parameters:
key
- map keyttl
- time to live for key\value entry. If0
then time to live doesn't affect entry expiration.maxIdleTime
- max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.if
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- returns
false
if entry already expired or doesn't exist, otherwise returnstrue
.
-
expireEntryAsync
Description copied from interface:RMapCacheAsync
Updates time to live and max idle time of specified entry by key. Entry expires when specified time to live or max idle time was reached.Returns
false
if entry already expired or doesn't exist, otherwise returnstrue
.- Specified by:
expireEntryAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyttl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.maxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.if
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- returns
false
if entry already expired or doesn't exist, otherwise returnstrue
.
-
expireEntryIfNotSet
Description copied from interface:RMapCache
Sets time to live and max idle time of specified entry by key. If these parameters weren't set before. Entry expires when specified time to live or max idle time was reached.Returns
false
if entry already has expiration time or doesn't exist, otherwise returnstrue
.- Specified by:
expireEntryIfNotSet
in interfaceRMapCache<K,
V> - Parameters:
key
- map keyttl
- time to live for key\value entry. If0
then time to live doesn't affect entry expiration.maxIdleTime
- max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.if
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- returns
false
if entry already has expiration time or doesn't exist, otherwise returnstrue
.
-
expireEntryIfNotSetAsync
-
expireEntriesIfNotSet
Description copied from interface:RMapCache
Sets time to live and max idle time of specified entries by keys. If these parameters weren't set before. Entries expire when specified time to live or max idle time was reached.Returns amount of updated entries.
- Specified by:
expireEntriesIfNotSet
in interfaceRMapCache<K,
V> - Parameters:
keys
- map keysttl
- time to live for key\value entry. If0
then time to live doesn't affect entry expiration.maxIdleTime
- max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.if
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- amount of updated entries.
-
expireEntriesIfNotSetAsync
-
expireEntries
Description copied from interface:RMapCache
Updates time to live and max idle time of specified entries by keys. Entries expires when specified time to live or max idle time was reached.Returns amount of updated entries.
- Specified by:
expireEntries
in interfaceRMapCache<K,
V> - Parameters:
keys
- map keysttl
- time to live for key\value entries. If0
then time to live doesn't affect entry expiration.maxIdleTime
- max idle time for key\value entries. If0
then max idle time doesn't affect entry expiration.if
maxIdleTime
andttl
params are equal to0
then entries are stored infinitely.- Returns:
- amount of updated entries.
-
expireEntriesAsync
Description copied from interface:RMapCacheAsync
Updates time to live and max idle time of specified entries by keys. Entries expires when specified time to live or max idle time was reached.Returns amount of updated entries.
- Specified by:
expireEntriesAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
keys
- map keysttl
- time to live for key\value entries. If0
then time to live doesn't affect entry expiration.maxIdleTime
- max idle time for key\value entries. If0
then max idle time doesn't affect entry expiration.if
maxIdleTime
andttl
params are equal to0
then entries are stored infinitely.- Returns:
- amount of updated entries.
-
putAsync
Description copied from interface:RMapCacheAsync
Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.- Specified by:
putAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then stores infinitely.ttlUnit
- - time unit- Returns:
- previous associated value
-
put
Description copied from interface:RMapCache
Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
- Specified by:
put
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- previous associated value
-
putAsync
public RFuture<V> putAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCacheAsync
Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
- Specified by:
putAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
- previous associated value
-
putOperationAsync
-
getWithTTLOnly
Description copied from interface:RMapCache
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.NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.
- Specified by:
getWithTTLOnly
in interfaceRMapCache<K,
V> - Parameters:
key
- the key- Returns:
- the value mapped by defined
key
ornull
if value is absent
-
getWithTTLOnlyAsync
Description copied from interface:RMapCacheAsync
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.NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.
- Specified by:
getWithTTLOnlyAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- the key- Returns:
- the value mapped by defined
key
ornull
if value is absent
-
getAllWithTTLOnly
Description copied from interface:RMapCache
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.NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.
- Specified by:
getAllWithTTLOnly
in interfaceRMapCache<K,
V> - Parameters:
keys
- map keys- Returns:
- Map slice
-
getAllWithTTLOnlyAsync
Description copied from interface:RMapCacheAsync
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.NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.
- Specified by:
getAllWithTTLOnlyAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
keys
- map keys- Returns:
- Map slice
-
getAllWithTTLOnlyOperationAsync
-
remainTimeToLive
Description copied from interface:RMapCache
Remaining time to live of map entry associated with akey
.- Specified by:
remainTimeToLive
in interfaceRMapCache<K,
V> - Parameters:
key
- - map key- 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:RMapCacheAsync
Remaining time to live of map entry associated with akey
.- Specified by:
remainTimeToLiveAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map key- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
removeOperationAsync
- Overrides:
removeOperationAsync
in classRedissonMap<K,
V>
-
fastRemoveOperationBatchAsync
- Overrides:
fastRemoveOperationBatchAsync
in classRedissonMap<K,
V>
-
fastRemoveOperationAsync
- Overrides:
fastRemoveOperationAsync
in classRedissonMap<K,
V>
-
scanKeyIteratorAsync
public RFuture<ScanResult<Object>> scanKeyIteratorAsync(String name, RedisClient client, long startPos, String pattern, int count) - Overrides:
scanKeyIteratorAsync
in classRedissonMap<K,
V>
-
scanIteratorAsync
public RFuture<ScanResult<Map.Entry<Object,Object>>> scanIteratorAsync(String name, RedisClient client, long startPos, String pattern, int count) - Overrides:
scanIteratorAsync
in classRedissonMap<K,
V>
-
fastPutOperationAsync
- Overrides:
fastPutOperationAsync
in classRedissonMap<K,
V>
-
fastPutIfExistsOperationAsync
- Overrides:
fastPutIfExistsOperationAsync
in classRedissonMap<K,
V>
-
fastPutIfAbsentOperationAsync
- Overrides:
fastPutIfAbsentOperationAsync
in classRedissonMap<K,
V>
-
fastPutIfAbsent
Description copied from interface:RMapCache
If the specified key is not already associated with a value, associate it with the given value.Stores value mapped by key with specified time to live. Entry expires after specified time to live.
Works faster than usual
RMapCache.putIfAbsent(Object, Object, long, TimeUnit)
as it not returns previous value.- Specified by:
fastPutIfAbsent
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then stores infinitely.ttlUnit
- - time unit- Returns:
true
if key is a new key in the hash and value was set.false
if key already exists in the hash
-
fastPutIfAbsent
public boolean fastPutIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCache
If the specified key is not already associated with a value, associate it with the given value.Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
Works faster than usual
RMapCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.- Specified by:
fastPutIfAbsent
in interfaceRMapCache<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
true
if key is a new key in the hash and value was set.false
if key already exists in the hash.
-
fastPutIfAbsentAsync
public RFuture<Boolean> fastPutIfAbsentAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit) Description copied from interface:RMapCacheAsync
If the specified key is not already associated with a value, associate it with the given value.Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
Works faster than usual
RMapCacheAsync.putIfAbsentAsync(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.- Specified by:
fastPutIfAbsentAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry. If0
then time to live doesn't affect entry expiration.ttlUnit
- - time unitmaxIdleTime
- - max idle time for key\value entry. If0
then max idle time doesn't affect entry expiration.maxIdleUnit
- - time unitif
maxIdleTime
andttl
params are equal to0
then entry stores infinitely.- Returns:
true
if key is a new key in the hash and value was set.false
if key already exists in the hash
-
replaceOperationAsync
- Overrides:
replaceOperationAsync
in classRedissonMap<K,
V>
-
fastReplaceOperationAsync
- Overrides:
fastReplaceOperationAsync
in classRedissonMap<K,
V>
-
replaceOperationAsync
- Overrides:
replaceOperationAsync
in classRedissonMap<K,
V>
-
putAllOperationAsync
- Overrides:
putAllOperationAsync
in classRedissonMap<K,
V>
-
addListener
Description copied from interface:RMapCache
Adds map entry listener- Specified by:
addListener
in interfaceRMapCache<K,
V> - Parameters:
listener
- - entry listener- Returns:
- listener id
- See Also:
-
getTopic
-
addListenerAsync
Description copied from interface:RMapCacheAsync
Adds map entry listener- Specified by:
addListenerAsync
in interfaceRMapCacheAsync<K,
V> - Parameters:
listener
- - entry 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 interfaceRMapCache<K,
V> - Specified by:
removeListener
in interfaceRObject
- Overrides:
removeListener
in classRedissonObject
- Parameters:
listenerId
- - listener id
-
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
-
clear
public void clear() -
clearAsync
Description copied from interface:RMapAsync
Clears map without removing options data used during map creation.- Specified by:
clearAsync
in interfaceRMapAsync<K,
V> - Overrides:
clearAsync
in classRedissonMap<K,
V> - Returns:
true
if map was clearedfalse
if not
-
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
-
expireAsync
-
expireAtAsync
-
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
-
readAllKeySetAsync
Description copied from interface:RMapAsync
Read all keys at once- Specified by:
readAllKeySetAsync
in interfaceRMapAsync<K,
V> - Overrides:
readAllKeySetAsync
in classRedissonMap<K,
V> - Returns:
- keys
-
randomKeysAsync
Description copied from interface:RMapAsync
Returns random keys from this map limited bycount
- Specified by:
randomKeysAsync
in interfaceRMapAsync<K,
V> - Overrides:
randomKeysAsync
in classRedissonMap<K,
V> - Parameters:
count
- - keys amount to return- Returns:
- random keys
-
randomEntriesAsync
Description copied from interface:RMapAsync
Returns random map entries from this map limited bycount
- Specified by:
randomEntriesAsync
in interfaceRMapAsync<K,
V> - Overrides:
randomEntriesAsync
in classRedissonMap<K,
V> - Parameters:
count
- - entries amount to return- Returns:
- random entries
-
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
-
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
-
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
-
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>
-
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
-
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
-
clearExpireAsync
-