Package org.redisson
Class RedissonFasterMultiLock
java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonBaseLock
org.redisson.RedissonFasterMultiLock
- All Implemented Interfaces:
Lock,RExpirable,RExpirableAsync,RLock,RLockAsync,RObject,RObjectAsync,RObservable,RObservableAsync
RedissonFasterMultiLock.
All lock, unlock, lockAsync unlockAsync methods only success when all values locked succeed.
Example:
there is a class, id is 100, and three students in class, Jack(id:001),Mary(id:002)
It will be saved In redis like this:
Of course the values `Jack_001`,`Mary_002` will be encoded and hashed.
All lock, unlock, lockAsync unlockAsync methods only success when all values locked succeed.
Example:
there is a class, id is 100, and three students in class, Jack(id:001),Mary(id:002)
- current thread id : 1
- ServiceManager id: 71b96ce8-2746......
- current time stamp: 1727422868000
redissonBatchLock.lock("class_100",Arrays.asList("Jack_001","Mary_002") It will be saved In redis like this:
----------------------------------------------------------------------- | redis type: hash | | redis Key: class_100 | ----------------------------------------------------------------------- | field | value | ----------------------------------------------------------------------- | Jack_001 | 71b96ce8-2746:1 | | Mary_002 | 71b96ce8-2746:1 | | Jack_001:71b96ce8-2746:1:expire_time | 1,727,422,898,000 | | Jack_001:71b96ce8-2746:1:lock_count | 1 | | Mary_002:71b96ce8-2746:1:expire_time | 1,727,422,898,000 | | Mary_002:71b96ce8-2746:1:lock_count | 1 | -----------------------------------------------------------------------Attention: the value of
group should be `smallest`, in our example above ,
group should be 'class_100' not just 'class' Of course the values `Jack_001`,`Mary_002` will be encoded and hashed.
- Author:
- lyrric
-
Field Summary
FieldsFields inherited from class org.redisson.RedissonObject
codec, name -
Constructor Summary
ConstructorsConstructorDescriptionRedissonFasterMultiLock(CommandAsyncExecutor commandExecutor, String group, Collection<Object> values) -
Method Summary
Modifier and TypeMethodDescriptionbooleanClear an expire timeout or expire date for object.Clear an expire timeout or expire date for object in async mode.clearExpireAsync(String... keys) booleanUseRExpirable.expire(Duration)insteadbooleanSets a timeout for this object.booleanSets 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.booleanexpireAt(long timestamp) UseRExpirable.expire(Instant)insteadbooleanUseRExpirable.expire(Instant)insteadexpireAtAsync(long timestamp) UseRExpirableAsync.expireAsync(Instant)insteadexpireAtAsync(long timestamp, String param, String... keys) expireAtAsync(Date timestamp) UseRExpirableAsync.expireAsync(Instant)insteadbooleanexpireIfGreater(Duration duration) Sets a timeout for this object only if it's greater than timeout set before.booleanexpireIfGreater(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.booleanexpireIfLess(Duration duration) Sets a timeout for this object only if it's less than timeout set before.booleanexpireIfLess(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.booleanexpireIfNotSet(Duration duration) Sets a timeout for this object only if it hasn't been set before.booleanexpireIfNotSet(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.booleanexpireIfSet(Duration duration) Sets a timeout for this object only if it has been already set.booleanexpireIfSet(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.booleanUnlocks the lock independently of its stateUnlocks the lock independently of its statelongReturns 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.intNumber of holds on this lock by the current threadNumber of holds on this lock by the current threadgetName()Returns name of objectbooleanChecks if this lock is held by the current threadbooleanisHeldByThread(long threadId) Checks if the lock is held by thread with definedthreadIdisHeldByThreadAsync(long threadId) Checks if the lock is held by thread with definedthreadIdbooleanisLocked()Checks if the lock locked by any threadChecks if the lock locked by any threadvoidlock()voidAcquires the lock with definedleaseTime.Acquires the lock with definedleaseTimeandthreadId.voidvoidlockInterruptibly(long leaseTime, TimeUnit unit) Acquires the lock with definedleaseTime.longReturns remaining time of the object in milliseconds.Returns remaining time of the object in milliseconds.protected CompletionStage<Boolean> renewExpirationAsync(long threadId) protected CompletableFuture<RedissonLockEntry> booleantryLock()booleanTries to acquire the lock with definedleaseTime.booleanTries to acquire the lock.tryLockAsync(long threadId) Tries to acquire the lock by thread with specifiedthreadId.tryLockAsync(long waitTime, long leaseTime, TimeUnit unit) Tries to acquire the lock with definedleaseTime.tryLockAsync(long waitTime, long leaseTime, TimeUnit unit, long currentThreadId) Tries to acquire the lock by thread with specifiedthreadIdandleaseTime.tryLockAsync(long waitTime, TimeUnit unit) Tries to acquire the lock.Unlocks the lockunlockAsync(long threadId) Unlocks the lock.unlockInnerAsync(long threadId, String requestId, int timeout) protected voidunsubscribe(RedissonLockEntry entry) Methods inherited from class org.redisson.RedissonBaseLock
acquireFailed, acquireFailedAsync, cancelExpirationRenewal, copyAsync, deleteAsync, evalWriteSyncedNoRetryAsync, getEntryName, getLockName, handleNoSync, lockAsync, lockAsync, lockAsync, newCondition, scheduleExpirationRenewal, trySuccessFalse, unlock, unlockInnerAsyncMethods inherited from class org.redisson.RedissonObject
addListener, addListener, addListener, addListenerAsync, addListenerAsync, addListenerAsync, addListenerId, addTrackingListener, addTrackingListenerAsync, checkNotBatch, copy, copy, copy, copyAndReplace, copyAndReplace, copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getListenerIdsByName, getLockByMapKey, getLockByValue, getNameByListenerId, getRawName, getRawName, getServiceManager, getSubscribeService, isExists, isExistsAsync, map, mapName, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListener, removeListenerAsync, 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, unlinkAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.redisson.api.RObject
addListener, copy, copy, copy, copyAndReplace, copyAndReplace, delete, dump, getCodec, getIdleTime, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkMethods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsyncMethods inherited from interface org.redisson.api.RObservable
addListener, removeListenerMethods inherited from interface org.redisson.api.RObservableAsync
addListenerAsync, removeListenerAsync
-
Field Details
-
internalLockLeaseTime
protected long internalLockLeaseTime
-
-
Constructor Details
-
RedissonFasterMultiLock
public RedissonFasterMultiLock(CommandAsyncExecutor commandExecutor, String group, Collection<Object> values)
-
-
Method Details
-
getName
Description copied from interface:RObjectReturns name of object -
lockInterruptibly
Description copied from interface:RLockAcquires the lock with definedleaseTime. Waits if necessary until lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
leaseTime- the maximum time to hold the lock after it's acquisition, if it hasn't already been released by invokingunlock. If leaseTime is -1, hold the lock until explicitly unlocked.unit- the time unit- Throws:
InterruptedException- - if the thread is interrupted
-
tryLock
Description copied from interface:RLockTries to acquire the lock with definedleaseTime. Waits up to definedwaitTimeif necessary until the lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
waitTime- the maximum time to acquire the lockleaseTime- lease timeunit- time unit- Returns:
trueif lock is successfully acquired, otherwisefalseif lock is already set.- Throws:
InterruptedException- - if the thread is interrupted
-
lock
Description copied from interface:RLockAcquires the lock with definedleaseTime. Waits if necessary until lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
leaseTime- the maximum time to hold the lock after it's acquisition, if it hasn't already been released by invokingunlock. If leaseTime is -1, hold the lock until explicitly unlocked.unit- the time unit
-
unsubscribe
-
subscribe
-
renewExpirationAsync
- Overrides:
renewExpirationAsyncin classRedissonBaseLock
-
forceUnlock
public boolean forceUnlock()Description copied from interface:RLockUnlocks the lock independently of its state- Specified by:
forceUnlockin interfaceRLock- Overrides:
forceUnlockin classRedissonBaseLock- Returns:
trueif lock existed and now unlocked otherwisefalse
-
isLocked
public boolean isLocked()Description copied from interface:RLockChecks if the lock locked by any thread- Specified by:
isLockedin interfaceRLock- Overrides:
isLockedin classRedissonBaseLock- Returns:
trueif locked otherwisefalse
-
isHeldByThread
public boolean isHeldByThread(long threadId) Description copied from interface:RLockChecks if the lock is held by thread with definedthreadId- Specified by:
isHeldByThreadin interfaceRLock- Overrides:
isHeldByThreadin classRedissonBaseLock- Parameters:
threadId- Thread ID of locking thread- Returns:
trueif held by thread with given id otherwisefalse
-
isHeldByCurrentThread
public boolean isHeldByCurrentThread()Description copied from interface:RLockChecks if this lock is held by the current thread- Specified by:
isHeldByCurrentThreadin interfaceRLock- Overrides:
isHeldByCurrentThreadin classRedissonBaseLock- Returns:
trueif held by current thread otherwisefalse
-
getHoldCount
public int getHoldCount()Description copied from interface:RLockNumber of holds on this lock by the current thread- Specified by:
getHoldCountin interfaceRLock- Overrides:
getHoldCountin classRedissonBaseLock- Returns:
- holds or
0if this lock is not held by current thread
-
remainTimeToLive
public long remainTimeToLive()Description copied from interface:RExpirableReturns remaining time of the object in milliseconds.- Specified by:
remainTimeToLivein interfaceRExpirable- Specified by:
remainTimeToLivein interfaceRLock- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
lock
public void lock() -
unlockInnerAsync
- Specified by:
unlockInnerAsyncin classRedissonBaseLock
-
lockInterruptibly
- Throws:
InterruptedException
-
tryLock
public boolean tryLock() -
tryLock
- Throws:
InterruptedException
-
forceUnlockAsync
Description copied from interface:RLockAsyncUnlocks the lock independently of its state- Returns:
trueif lock existed and now unlocked otherwisefalse
-
unlockAsync
Description copied from interface:RLockAsyncUnlocks the lock- Specified by:
unlockAsyncin interfaceRLockAsync- Overrides:
unlockAsyncin classRedissonBaseLock- Returns:
- void
-
unlockAsync
Description copied from interface:RLockAsyncUnlocks the lock. ThrowsIllegalMonitorStateExceptionif lock isn't locked by thread with specifiedthreadId.- Specified by:
unlockAsyncin interfaceRLockAsync- Overrides:
unlockAsyncin classRedissonBaseLock- Parameters:
threadId- id of thread- Returns:
- void
-
lockAsync
Description copied from interface:RLockAsyncAcquires the lock with definedleaseTimeandthreadId. Waits if necessary until lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
leaseTime- the maximum time to hold the lock after it's acquisition, if it hasn't already been released by invokingunlock. If leaseTime is -1, hold the lock until explicitly unlocked.unit- the time unitcurrentThreadId- id of thread- Returns:
- void
-
tryLockAsync
Description copied from interface:RLockAsyncTries to acquire the lock.- Specified by:
tryLockAsyncin interfaceRLockAsync- Overrides:
tryLockAsyncin classRedissonBaseLock- Returns:
trueif lock acquired otherwisefalse
-
tryLockAsync
Description copied from interface:RLockAsyncTries to acquire the lock by thread with specifiedthreadId.- Parameters:
threadId- id of thread- Returns:
trueif lock acquired otherwisefalse
-
tryLockAsync
Description copied from interface:RLockAsyncTries to acquire the lock. Waits up to definedwaitTimeif necessary until the lock became available.- Specified by:
tryLockAsyncin interfaceRLockAsync- Overrides:
tryLockAsyncin classRedissonBaseLock- Parameters:
waitTime- the maximum time to acquire the lockunit- time unit- Returns:
trueif lock is successfully acquired, otherwisefalseif lock is already set.
-
tryLockAsync
Description copied from interface:RLockAsyncTries to acquire the lock with definedleaseTime. Waits up to definedwaitTimeif necessary until the lock became available. Lock will be released automatically after definedleaseTimeinterval.- Specified by:
tryLockAsyncin interfaceRLockAsync- Overrides:
tryLockAsyncin classRedissonBaseLock- Parameters:
waitTime- the maximum time to acquire the lockleaseTime- lease timeunit- time unit- Returns:
trueif lock is successfully acquired, otherwisefalseif lock is already set.
-
tryLockAsync
public RFuture<Boolean> tryLockAsync(long waitTime, long leaseTime, TimeUnit unit, long currentThreadId) Description copied from interface:RLockAsyncTries to acquire the lock by thread with specifiedthreadIdandleaseTime. Waits up to definedwaitTimeif necessary until the lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
waitTime- time interval to acquire lockleaseTime- time interval after which lock will be released automaticallyunit- the time unit of thewaitTimeandleaseTimeargumentscurrentThreadId- id of thread- Returns:
trueif lock acquired otherwisefalse
-
isHeldByThreadAsync
Description copied from interface:RLockAsyncChecks if the lock is held by thread with definedthreadId- Specified by:
isHeldByThreadAsyncin interfaceRLockAsync- Overrides:
isHeldByThreadAsyncin classRedissonBaseLock- Parameters:
threadId- Thread ID of locking thread- Returns:
trueif held by thread with given id otherwisefalse
-
getHoldCountAsync
Description copied from interface:RLockAsyncNumber of holds on this lock by the current thread- Specified by:
getHoldCountAsyncin interfaceRLockAsync- Overrides:
getHoldCountAsyncin classRedissonBaseLock- Returns:
- holds or
0if this lock is not held by current thread
-
isLockedAsync
Description copied from interface:RLockAsyncChecks if the lock locked by any thread- Specified by:
isLockedAsyncin interfaceRLockAsync- Overrides:
isLockedAsyncin classRedissonBaseLock- Returns:
- any one locked,return true,else false
-
remainTimeToLiveAsync
Description copied from interface:RExpirableAsyncReturns remaining time of the object in milliseconds.- Specified by:
remainTimeToLiveAsyncin interfaceRExpirableAsync- Specified by:
remainTimeToLiveAsyncin interfaceRLockAsync- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
expire
Description copied from interface:RExpirableUseRExpirable.expire(Duration)instead- Specified by:
expirein interfaceRExpirable- Parameters:
timeToLive- - timeout before object will be deletedtimeUnit- - timeout time unit- Returns:
trueif the timeout was set andfalseif not
-
expireAsync
Description copied from interface:RExpirableAsyncUseRExpirableAsync.expireAsync(Duration)instead- Specified by:
expireAsyncin interfaceRExpirableAsync- Parameters:
timeToLive- - timeout before object will be deletedtimeUnit- - timeout time unit- Returns:
trueif the timeout was set andfalseif not
-
expireAt
public boolean expireAt(long timestamp) Description copied from interface:RExpirableUseRExpirable.expire(Instant)instead- Specified by:
expireAtin interfaceRExpirable- Parameters:
timestamp- - expire date in milliseconds (Unix timestamp)- Returns:
trueif the timeout was set andfalseif not
-
expireAtAsync
Description copied from interface:RExpirableAsyncUseRExpirableAsync.expireAsync(Instant)instead- Specified by:
expireAtAsyncin interfaceRExpirableAsync- Parameters:
timestamp- - expire date in milliseconds (Unix timestamp)- Returns:
trueif the timeout was set andfalseif not
-
expire
Description copied from interface:RExpirableSets an expiration date for this object. When expire date comes the key will automatically be deleted.- Specified by:
expirein interfaceRExpirable- Parameters:
instant- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfSet
Description copied from interface:RExpirableSets 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:
expireIfSetin interfaceRExpirable- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfSetAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfSetAsyncin interfaceRExpirableAsync- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfNotSet
Description copied from interface:RExpirableSets 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:
expireIfNotSetin interfaceRExpirable- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfNotSetAsyncin interfaceRExpirableAsync- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfGreater
Description copied from interface:RExpirableSets 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:
expireIfGreaterin interfaceRExpirable- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfGreaterAsyncin interfaceRExpirableAsync- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfLess
Description copied from interface:RExpirableSets 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:
expireIfLessin interfaceRExpirable- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfLessAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfLessAsyncin interfaceRExpirableAsync- Parameters:
time- expire date- Returns:
trueif the timeout was set andfalseif not
-
expireAsync
Description copied from interface:RExpirableAsyncSet an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAsyncin interfaceRExpirableAsync- Parameters:
instant- - expire date- Returns:
trueif the timeout was set andfalseif not
-
expire
Description copied from interface:RExpirableSets a timeout for this object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expirein interfaceRExpirable- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireAsync
Description copied from interface:RExpirableAsyncSet a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsyncin interfaceRExpirableAsync- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireAt
Description copied from interface:RExpirableUseRExpirable.expire(Instant)instead- Specified by:
expireAtin interfaceRExpirable- Parameters:
timestamp- - expire date- Returns:
trueif the timeout was set andfalseif not
-
expireAtAsync
Description copied from interface:RExpirableAsyncUseRExpirableAsync.expireAsync(Instant)instead- Specified by:
expireAtAsyncin interfaceRExpirableAsync- Parameters:
timestamp- - expire date- Returns:
trueif the timeout was set andfalseif not
-
expireIfSet
Description copied from interface:RExpirableSets 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:
expireIfSetin interfaceRExpirable- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireIfSetAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfSetAsyncin interfaceRExpirableAsync- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireIfNotSet
Description copied from interface:RExpirableSets 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:
expireIfNotSetin interfaceRExpirable- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfNotSetAsyncin interfaceRExpirableAsync- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireIfGreater
Description copied from interface:RExpirableSets 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:
expireIfGreaterin interfaceRExpirable- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfGreaterAsyncin interfaceRExpirableAsync- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireIfLess
Description copied from interface:RExpirableSets 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:
expireIfLessin interfaceRExpirable- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
expireIfLessAsync
Description copied from interface:RExpirableAsyncSets 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:
expireIfLessAsyncin interfaceRExpirableAsync- Parameters:
duration- timeout before object will be deleted- Returns:
trueif the timeout was set andfalseif not
-
clearExpire
public boolean clearExpire()Description copied from interface:RExpirableClear an expire timeout or expire date for object.- Specified by:
clearExpirein interfaceRExpirable- Returns:
trueif timeout was removedfalseif object does not exist or does not have an associated timeout
-
clearExpireAsync
Description copied from interface:RExpirableAsyncClear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsyncin interfaceRExpirableAsync- Returns:
trueif the timeout was cleared andfalseif not
-
getExpireTime
public long getExpireTime()Description copied from interface:RExpirableReturns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.Requires Redis 7.0.0 and higher.
- Specified by:
getExpireTimein 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:RExpirableAsyncReturns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.Requires Redis 7.0.0 and higher.
- Specified by:
getExpireTimeAsyncin 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
-