Class RedissonBucket<V>
- Type Parameters:
V
- value type
- All Implemented Interfaces:
RBucket<V>
,RBucketAsync<V>
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
- Direct Known Subclasses:
ExpireAtOperation.RedissonBucketExtended
,ExpireOperation.RedissonBucketExtended
,RedissonBinaryStream
,RedissonTransactionalBucket
- Author:
- Nikita Koksharov
-
Field Summary
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
Constructor Summary
ConstructorDescriptionRedissonBucket
(String name, Codec codec, CommandAsyncExecutor connectionManager) RedissonBucket
(Codec codec, CommandAsyncExecutor connectionManager, String name) RedissonBucket
(CommandAsyncExecutor connectionManager, String name) -
Method Summary
Modifier and TypeMethodDescriptionint
addListener
(ObjectListener listener) Adds object event listeneraddListenerAsync
(ObjectListener listener) Adds object event listenerboolean
Clear an expire timeout or expire date for object.Clear an expire timeout or expire date for object in async mode.clearExpireAsync
(String... keys) boolean
compareAndSet
(V expect, V update) Atomically sets the value to the given updated value only if serialized state of the current value equals to serialized state of the expected value.compareAndSetAsync
(V expect, V update) Atomically sets the value to the given updated value only if serialized state of the current value equals to serialized state of the expected value.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.findCommon
(String name) Returns the common part of the data stored in this bucket and a bucket defined by thename
findCommonAsync
(String name) Returns the common part of the data stored in this bucket and a bucket defined by thename
long
findCommonLength
(String name) Returns the length of the common part of the data stored in this bucket and a bucket defined by thename
findCommonLengthAsync
(String name) Returns the length of the common part of the data stored in this bucket and a bucket defined by thename
get()
Retrieves element stored in the holder.Retrieves current element in the holder and clears expiration date set before.Retrieves current element in the holder and clears expiration date set before.Retrieves element in the holder and removes it.Retrieves element in the holder and removes it.getAndExpire
(Duration duration) Retrieves current element in the holder and sets an expiration duration for it.getAndExpire
(Instant time) Retrieves current element in the holder and sets an expiration date for it.getAndExpireAsync
(Duration duration) Retrieves current element in the holder and sets an expiration duration for it.getAndExpireAsync
(Instant time) Retrieves current element in the holder and sets an expiration date for it.Retrieves current element in the holder and replaces it withnewValue
.UseRBucket.getAndSet(Object, Duration)
insteadRetrieves current element in the holder and replaces it withvalue
with defined expirationduration
.getAndSetAsync
(V newValue) Retrieves current element in the holder and replaces it withnewValue
.getAndSetAsync
(V value, long timeToLive, TimeUnit timeUnit) UseRBucketAsync.getAndSetAsync(Object, Duration)
insteadgetAndSetAsync
(V value, Duration duration) Retrieves current element in the holder and replaces it withvalue
with defined expirationduration
.getAsync()
Retrieves element stored in the holder.long
Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.long
Returns remaining time of the object in milliseconds.Returns remaining time of the object in milliseconds.void
removeListener
(int listenerId) Removes object event listenerremoveListenerAsync
(int listenerId) Removes object event listenervoid
Stores element into the holder.void
UseRBucket.set(Object, Duration)
insteadvoid
Storesvalue
into the holder with defined expirationduration
.void
setAndKeepTTL
(V value) Set value and keep existing TTL.setAndKeepTTLAsync
(V value) Set value and keep existing TTL.Stores element into the holder.UseRBucketAsync.setAsync(Object, Duration)
insteadStoresvalue
into the holder with defined expirationduration
.boolean
setIfAbsent
(V value) Sets value only if object holder doesn't exist.boolean
setIfAbsent
(V value, Duration duration) Sets value with defined duration only if object holder doesn't exist.setIfAbsentAsync
(V value) Sets value only if object holder doesn't exist.setIfAbsentAsync
(V value, Duration duration) Sets value with defined duration only if object holder doesn't exist.boolean
setIfExists
(V value) Sets value only if object holder already exists.boolean
setIfExists
(V value, long timeToLive, TimeUnit timeUnit) UseRBucket.setIfExists(Object, Duration)
insteadboolean
setIfExists
(V value, Duration duration) Setsvalue
with expirationduration
only if object holder already exists.setIfExistsAsync
(V value) Sets value only if it's already exists.setIfExistsAsync
(V value, long timeToLive, TimeUnit timeUnit) UseRBucketAsync.setIfExistsAsync(Object, Duration)
insteadsetIfExistsAsync
(V value, Duration duration) Setsvalue
with expirationduration
only if object holder already exists.long
size()
Returns size of object in bytes.Returns size of object in bytesboolean
UseRBucket.setIfAbsent(Object)
insteadboolean
UseRBucket.setIfAbsent(Object, Duration)
insteadtrySetAsync
(V value) UseRBucketAsync.setIfAbsentAsync(Object)
insteadtrySetAsync
(V value, long timeToLive, TimeUnit timeUnit) UseRBucketAsync.setIfAbsentAsync(Object, Duration)
insteadMethods inherited from class org.redisson.RedissonObject
addListener, addListener, addListenerAsync, addListenerAsync, addListenerId, addTrackingListener, addTrackingListenerAsync, checkNotBatch, copy, copy, copy, copyAndReplace, copyAndReplace, copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, copyAsync, copyAsync, delete, deleteAsync, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getListenerIdsByName, getLockByMapKey, getLockByValue, getName, getNameByListenerId, getRawName, getRawName, getServiceManager, getSubscribeService, isExists, isExistsAsync, map, mapName, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenerAsync, removeListenerId, removeListeners, removeTrackingListener, removeTrackingListenerAsync, rename, renameAsync, renameAsync, renameAsync, renamenx, renamenxAsync, renamenxAsync, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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.RObject
copy, copy, copy, copyAndReplace, copyAndReplace, 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
copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Constructor Details
-
RedissonBucket
-
RedissonBucket
-
RedissonBucket
-
-
Method Details
-
compareAndSet
Description copied from interface:RBucket
Atomically sets the value to the given updated value only if serialized state of the current value equals to serialized state of the expected value.- Specified by:
compareAndSet
in interfaceRBucket<V>
- Parameters:
expect
- the expected valueupdate
- the new value- Returns:
true
if successful; orfalse
if the actual value was not equal to the expected value.
-
compareAndSetAsync
Description copied from interface:RBucketAsync
Atomically sets the value to the given updated value only if serialized state of the current value equals to serialized state of the expected value.- Specified by:
compareAndSetAsync
in interfaceRBucketAsync<V>
- Parameters:
expect
- the expected valueupdate
- the new value- Returns:
true
if successful; orfalse
if the actual value was not equal to the expected value.
-
getAndSet
Description copied from interface:RBucket
Retrieves current element in the holder and replaces it withnewValue
. -
getAndSetAsync
Description copied from interface:RBucketAsync
Retrieves current element in the holder and replaces it withnewValue
.- Specified by:
getAndSetAsync
in interfaceRBucketAsync<V>
- Parameters:
newValue
- - value to set- Returns:
- previous value
-
getAndExpire
Description copied from interface:RBucket
Retrieves current element in the holder and sets an expiration date for it.Requires Redis 6.2.0 and higher.
- Specified by:
getAndExpire
in interfaceRBucket<V>
- Parameters:
time
- of exact object expiration moment- Returns:
- element
-
getAndExpireAsync
Description copied from interface:RBucketAsync
Retrieves current element in the holder and sets an expiration date for it.Requires Redis 6.2.0 and higher.
- Specified by:
getAndExpireAsync
in interfaceRBucketAsync<V>
- Parameters:
time
- of exact object expiration moment- Returns:
- element
-
getAndExpire
Description copied from interface:RBucket
Retrieves current element in the holder and sets an expiration duration for it.Requires Redis 6.2.0 and higher.
- Specified by:
getAndExpire
in interfaceRBucket<V>
- Parameters:
duration
- of object time to live interval- Returns:
- element
-
getAndExpireAsync
Description copied from interface:RBucketAsync
Retrieves current element in the holder and sets an expiration duration for it.Requires Redis 6.2.0 and higher.
- Specified by:
getAndExpireAsync
in interfaceRBucketAsync<V>
- Parameters:
duration
- of object time to live interval- Returns:
- element
-
getAndClearExpire
Description copied from interface:RBucket
Retrieves current element in the holder and clears expiration date set before.Requires Redis 6.2.0 and higher.
- Specified by:
getAndClearExpire
in interfaceRBucket<V>
- Returns:
- element
-
getAndClearExpireAsync
Description copied from interface:RBucketAsync
Retrieves current element in the holder and clears expiration date set before.Requires Redis 6.2.0 and higher.
- Specified by:
getAndClearExpireAsync
in interfaceRBucketAsync<V>
- Returns:
- element
-
get
Description copied from interface:RBucket
Retrieves element stored in the holder. -
getAsync
Description copied from interface:RBucketAsync
Retrieves element stored in the holder.- Specified by:
getAsync
in interfaceRBucketAsync<V>
- Returns:
- element
-
getAndDelete
Description copied from interface:RBucket
Retrieves element in the holder and removes it.- Specified by:
getAndDelete
in interfaceRBucket<V>
- Returns:
- element
-
getAndDeleteAsync
Description copied from interface:RBucketAsync
Retrieves element in the holder and removes it.- Specified by:
getAndDeleteAsync
in interfaceRBucketAsync<V>
- Returns:
- element
-
size
public long size()Description copied from interface:RBucket
Returns size of object in bytes. -
sizeAsync
Description copied from interface:RBucketAsync
Returns size of object in bytes- Specified by:
sizeAsync
in interfaceRBucketAsync<V>
- Returns:
- object size
-
set
Description copied from interface:RBucket
Stores element into the holder. -
setAsync
Description copied from interface:RBucketAsync
Stores element into the holder.- Specified by:
setAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to set- Returns:
- void
-
set
Description copied from interface:RBucket
UseRBucket.set(Object, Duration)
instead -
setAsync
Description copied from interface:RBucketAsync
UseRBucketAsync.setAsync(Object, Duration)
instead- Specified by:
setAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live interval- Returns:
- void
-
set
Description copied from interface:RBucket
Storesvalue
into the holder with defined expirationduration
. -
setAsync
Description copied from interface:RBucketAsync
Storesvalue
into the holder with defined expirationduration
.- Specified by:
setAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- value to setduration
- expiration duration
-
trySetAsync
Description copied from interface:RBucketAsync
UseRBucketAsync.setIfAbsentAsync(Object)
instead- Specified by:
trySetAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to set- Returns:
true
if successful, orfalse
if element was already set
-
trySetAsync
Description copied from interface:RBucketAsync
UseRBucketAsync.setIfAbsentAsync(Object, Duration)
instead- Specified by:
trySetAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live interval- Returns:
true
if successful, orfalse
if element was already set
-
trySet
Description copied from interface:RBucket
UseRBucket.setIfAbsent(Object, Duration)
instead -
trySet
Description copied from interface:RBucket
UseRBucket.setIfAbsent(Object)
instead -
setIfAbsent
Description copied from interface:RBucket
Sets value only if object holder doesn't exist.- Specified by:
setIfAbsent
in interfaceRBucket<V>
- Parameters:
value
- - value to set- Returns:
true
if successful, orfalse
if element was already set
-
setIfAbsent
Description copied from interface:RBucket
Sets value with defined duration only if object holder doesn't exist.- Specified by:
setIfAbsent
in interfaceRBucket<V>
- Parameters:
value
- value to setduration
- expiration duration- Returns:
true
if successful, orfalse
if element was already set
-
setIfAbsentAsync
Description copied from interface:RBucketAsync
Sets value only if object holder doesn't exist.- Specified by:
setIfAbsentAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to set- Returns:
true
if successful, orfalse
if element was already set
-
setIfAbsentAsync
Description copied from interface:RBucketAsync
Sets value with defined duration only if object holder doesn't exist.- Specified by:
setIfAbsentAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- value to setduration
- expiration duration- Returns:
true
if successful, orfalse
if element was already set
-
setIfExists
Description copied from interface:RBucket
Sets value only if object holder already exists.- Specified by:
setIfExists
in interfaceRBucket<V>
- Parameters:
value
- - value to set- Returns:
true
if successful, orfalse
if element wasn't set
-
setIfExistsAsync
Description copied from interface:RBucketAsync
Sets value only if it's already exists.- Specified by:
setIfExistsAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to set- Returns:
true
if successful, orfalse
if element wasn't set
-
setAndKeepTTL
Description copied from interface:RBucket
Set value and keep existing TTL.Requires Redis 6.0.0 and higher.
- Specified by:
setAndKeepTTL
in interfaceRBucket<V>
- Parameters:
value
- - value to set
-
setAndKeepTTLAsync
Description copied from interface:RBucketAsync
Set value and keep existing TTL.Requires Redis 6.0.0 and higher.
- Specified by:
setAndKeepTTLAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to set- Returns:
- void
-
setIfExists
Description copied from interface:RBucket
UseRBucket.setIfExists(Object, Duration)
instead- Specified by:
setIfExists
in interfaceRBucket<V>
- Parameters:
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live interval- Returns:
true
if successful, orfalse
if element wasn't set
-
setIfExistsAsync
Description copied from interface:RBucketAsync
UseRBucketAsync.setIfExistsAsync(Object, Duration)
instead- Specified by:
setIfExistsAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live interval- Returns:
true
if successful, orfalse
if element wasn't set
-
setIfExists
Description copied from interface:RBucket
Setsvalue
with expirationduration
only if object holder already exists.- Specified by:
setIfExists
in interfaceRBucket<V>
- Parameters:
value
- value to setduration
- expiration duration- Returns:
true
if successful, orfalse
if element wasn't set
-
setIfExistsAsync
Description copied from interface:RBucketAsync
Setsvalue
with expirationduration
only if object holder already exists.- Specified by:
setIfExistsAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- value to setduration
- expiration duration- Returns:
true
if successful, orfalse
if element wasn't set
-
getAndSet
Description copied from interface:RBucket
Retrieves current element in the holder and replaces it withvalue
with defined expirationduration
. -
getAndSetAsync
Description copied from interface:RBucketAsync
Retrieves current element in the holder and replaces it withvalue
with defined expirationduration
.- Specified by:
getAndSetAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- value to setduration
- expiration duration- Returns:
- previous value
-
getAndSetAsync
Description copied from interface:RBucketAsync
UseRBucketAsync.getAndSetAsync(Object, Duration)
instead- Specified by:
getAndSetAsync
in interfaceRBucketAsync<V>
- Parameters:
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live interval- Returns:
- previous value
-
getAndSet
Description copied from interface:RBucket
UseRBucket.getAndSet(Object, Duration)
instead -
addListener
Description copied from interface:RObject
Adds object event listener- Specified by:
addListener
in interfaceRBucket<V>
- Specified by:
addListener
in interfaceRObject
- Overrides:
addListener
in classRedissonObject
- Parameters:
listener
- - object event listener- Returns:
- listener id
- See Also:
-
addListenerAsync
Description copied from interface:RObjectAsync
Adds object event listener- Specified by:
addListenerAsync
in interfaceRBucketAsync<V>
- Specified by:
addListenerAsync
in interfaceRObjectAsync
- Overrides:
addListenerAsync
in classRedissonObject
- 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 classRedissonObject
- Parameters:
listenerId
- - listener id
-
removeListenerAsync
Description copied from interface:RObjectAsync
Removes object event listener- Specified by:
removeListenerAsync
in interfaceRObjectAsync
- Overrides:
removeListenerAsync
in classRedissonObject
- Parameters:
listenerId
- - listener id
-
findCommon
Description copied from interface:RBucket
Returns the common part of the data stored in this bucket and a bucket defined by thename
- Specified by:
findCommon
in interfaceRBucket<V>
- Parameters:
name
- second bucket- Returns:
- common part of the data
-
findCommonAsync
Description copied from interface:RBucketAsync
Returns the common part of the data stored in this bucket and a bucket defined by thename
- Specified by:
findCommonAsync
in interfaceRBucketAsync<V>
- Parameters:
name
- second bucket- Returns:
- common part of the data
-
findCommonLength
Description copied from interface:RBucket
Returns the length of the common part of the data stored in this bucket and a bucket defined by thename
- Specified by:
findCommonLength
in interfaceRBucket<V>
- Parameters:
name
- second bucket- Returns:
- common part of the data
-
findCommonLengthAsync
Description copied from interface:RBucketAsync
Returns the length of the common part of the data stored in this bucket and a bucket defined by thename
- Specified by:
findCommonLengthAsync
in interfaceRBucketAsync<V>
- Parameters:
name
- second bucket- Returns:
- common part of the data
-
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
Returns remaining time of the object in milliseconds.- 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
Returns remaining time of the object in milliseconds.- 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
Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.Requires Redis 7.0.0 and higher.
- Specified by:
getExpireTime
in interfaceRExpirable
- Returns:
- Unix time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expiration time.
-
getExpireTimeAsync
Description copied from interface:RExpirableAsync
Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.Requires Redis 7.0.0 and higher.
- Specified by:
getExpireTimeAsync
in interfaceRExpirableAsync
- Returns:
- Unix time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expiration time.
-
expireAsync
-
expireAtAsync
-
clearExpireAsync
-