Package org.redisson
Class RedissonPermitExpirableSemaphore
java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonPermitExpirableSemaphore
- All Implemented Interfaces:
RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
,RPermitExpirableSemaphore
,RPermitExpirableSemaphoreAsync
public class RedissonPermitExpirableSemaphore
extends RedissonObject
implements RPermitExpirableSemaphore
- Author:
- Nikita Koksharov
-
Field Summary
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
Constructor Summary
ConstructorDescriptionRedissonPermitExpirableSemaphore
(CommandAsyncExecutor commandExecutor, String name) -
Method Summary
Modifier and TypeMethodDescriptionacquire()
Acquires a permit and returns its id.acquire
(int permits) Acquires defined amount ofpermits
.Acquires defined amount ofpermits
with definedleaseTime
and returns ids.Acquires a permit with definedleaseTime
and return its id.Acquires a permit and returns its id.acquireAsync
(int permits) Acquires defined amount ofpermits
and returns their ids.acquireAsync
(int permits, long leaseTime, TimeUnit timeUnit) Acquires defined amount ofpermits
and return their ids.acquireAsync
(long leaseTime, TimeUnit timeUnit) Acquires a permit with definedleaseTime
and return its id.int
Returns the number of acquired permits.Returns the number of acquired permits.void
addPermits
(int permits) Increases or decreases the number of available permits by defined value.addPermitsAsync
(int permits) Increases or decreases the number of available permits by defined value.int
Returns number of available permits.Returns number of available permits.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) Delete object in async modeboolean
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.long
Expiration time of Redisson object that has a timeoutExpiration time of Redisson object that has a timeoutint
Returns the number of permits.Returns the number of permits.void
Releases a permit by its id.void
Releases permits by their ids.releaseAsync
(String permitId) Releases a permit by its id.releaseAsync
(List<String> permitsIds) Releases permits by their ids.long
Remaining time to live of Redisson object that has a timeoutRemaining time to live of Redisson object that has a timeoutvoid
setPermits
(int permits) Sets the number of permits to the provided value.setPermitsAsync
(int permits) Sets the number of permits to the provided value.Returns bytes amount used by object in Redis memory.Tries to acquire currently available permit and return its id.tryAcquire
(int permits) Tries to acquire defined amount of currently availablepermits
and returns ids.tryAcquire
(int permits, long waitTime, long leaseTime, TimeUnit unit) Tries to acquire defined amount of currently availablepermits
with definedleaseTime
and return ids.tryAcquire
(long waitTime, long leaseTime, TimeUnit unit) Tries to acquire currently available permit with definedleaseTime
and return its id.tryAcquire
(long waitTime, TimeUnit unit) Tries to acquire currently available permit and return its id.Tries to acquire currently available permit and return its id.tryAcquireAsync
(int permits) Tries to acquire defined amount of currently availablepermits
and returns their ids.tryAcquireAsync
(int permits, long waitTime, long leaseTime, TimeUnit timeUnit) Tries to acquire defined amount of currently availablepermits
with definedleaseTime
and returns their ids.tryAcquireAsync
(long waitTime, long leaseTime, TimeUnit unit) Tries to acquire currently available permit with definedleaseTime
and return its id.tryAcquireAsync
(long waitTime, TimeUnit unit) Tries to acquire currently available permit and return its id.boolean
tryRelease
(String permitId) Tries to release permit by its id.int
tryRelease
(List<String> permitsIds) Tries to release permits by their ids.tryReleaseAsync
(String permitId) Tries to release permit by its id.tryReleaseAsync
(List<String> permitsIds) Tries to release defined permits by their ids.boolean
trySetPermits
(int permits) Tries to set the initial number of available permits.trySetPermitsAsync
(int permits) Tries to set number of available permits.boolean
updateLeaseTime
(String permitId, long leaseTime, TimeUnit unit) Overrides and updates lease time for defined permit id.updateLeaseTimeAsync
(String permitId, long leaseTime, TimeUnit unit) Overrides and updates lease time for defined permit id.Methods inherited from class org.redisson.RedissonObject
addListener, addListener, addListenerAsync, addListenerAsync, addTrackingListener, addTrackingListenerAsync, 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, removeListener, removeListener, removeListenerAsync, removeListenerAsync, removeListenerAsync, removeTrackingListener, removeTrackingListenerAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
Methods inherited from class java.lang.Object
clone, 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
expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsync
Methods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
-
Constructor Details
-
RedissonPermitExpirableSemaphore
-
-
Method Details
-
acquire
Description copied from interface:RPermitExpirableSemaphore
Acquires a permit and returns its id. Waits if necessary until a permit became available.- Specified by:
acquire
in interfaceRPermitExpirableSemaphore
- Returns:
- permit id
- Throws:
InterruptedException
- if the current thread is interrupted
-
acquire
Description copied from interface:RPermitExpirableSemaphore
Acquires defined amount ofpermits
. Waits if necessary until enough permits became available.- Specified by:
acquire
in interfaceRPermitExpirableSemaphore
- Parameters:
permits
- the number of permits to acquire- Returns:
- permits ids
- Throws:
InterruptedException
- if the current thread is interrupted
-
acquire
Description copied from interface:RPermitExpirableSemaphore
Acquires a permit with definedleaseTime
and return its id. Waits if necessary until a permit became available.- Specified by:
acquire
in interfaceRPermitExpirableSemaphore
- Parameters:
leaseTime
- permit lease timetimeUnit
- time unit- Returns:
- permit id
- Throws:
InterruptedException
- if the current thread is interrupted
-
acquire
public List<String> acquire(int permits, long leaseTime, TimeUnit timeUnit) throws InterruptedException Description copied from interface:RPermitExpirableSemaphore
Acquires defined amount ofpermits
with definedleaseTime
and returns ids. Waits if necessary until enough permits became available.- Specified by:
acquire
in interfaceRPermitExpirableSemaphore
- Parameters:
permits
- the number of permits to acquireleaseTime
- permit lease timetimeUnit
- time unit- Returns:
- permits ids
- Throws:
InterruptedException
- if the current thread is interrupted
-
acquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Acquires a permit and returns its id. Waits if necessary until a permit became available.- Specified by:
acquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Returns:
- permit id
-
acquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Acquires defined amount ofpermits
and returns their ids. Waits if necessary until all permits became available.- Specified by:
acquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permits
- the number of permits to acquire- Returns:
- permits ids
-
acquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Acquires a permit with definedleaseTime
and return its id. Waits if necessary until a permit became available.- Specified by:
acquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
leaseTime
- permit lease timetimeUnit
- time unit- Returns:
- permit id
-
acquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Acquires defined amount ofpermits
and return their ids. Waits if necessary until all permits became available.- Specified by:
acquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permits
- the number of permits to acquireleaseTime
- permit lease timetimeUnit
- time unit- Returns:
- permits ids
-
tryAcquire
Description copied from interface:RPermitExpirableSemaphore
Tries to acquire currently available permit and return its id.- Specified by:
tryAcquire
in interfaceRPermitExpirableSemaphore
- Returns:
- permit id if a permit was acquired and
null
otherwise
-
tryAcquire
Description copied from interface:RPermitExpirableSemaphore
Tries to acquire defined amount of currently availablepermits
and returns ids.- Specified by:
tryAcquire
in interfaceRPermitExpirableSemaphore
- Parameters:
permits
- the number of permits to acquire- Returns:
- permits ids if permits were acquired and empty collection otherwise
-
tryAcquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to acquire currently available permit and return its id.- Specified by:
tryAcquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Returns:
- permit id if a permit was acquired and
null
otherwise
-
tryAcquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to acquire defined amount of currently availablepermits
and returns their ids.- Specified by:
tryAcquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permits
- the number of permits to acquire- Returns:
- permits ids if permits were acquired and empty list otherwise
-
tryAcquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to acquire currently available permit and return its id. Waits up to definedwaitTime
if necessary until a permit became available.- Specified by:
tryAcquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
waitTime
- the maximum time to waitunit
- the time unit- Returns:
- permit id if a permit was acquired and
null
if the waiting time elapsed before a permit was acquired
-
tryAcquire
Description copied from interface:RPermitExpirableSemaphore
Tries to acquire currently available permit with definedleaseTime
and return its id. Waits up to definedwaitTime
if necessary until a permit became available.- Specified by:
tryAcquire
in interfaceRPermitExpirableSemaphore
- Parameters:
waitTime
- the maximum time to waitleaseTime
- permit lease time, use -1 to make it permanentunit
- the time unit- Returns:
- permit id if a permit was acquired and
null
if the waiting time elapsed before a permit was acquired - Throws:
InterruptedException
- if the current thread is interrupted
-
tryAcquireAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to acquire currently available permit with definedleaseTime
and return its id. Waits up to definedwaitTime
if necessary until a permit became available.- Specified by:
tryAcquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
waitTime
- the maximum time to waitleaseTime
- permit lease time, use -1 to make it permanentunit
- the time unit- Returns:
- permit id if a permit was acquired and
null
if the waiting time elapsed before a permit was acquired
-
tryAcquire
public List<String> tryAcquire(int permits, long waitTime, long leaseTime, TimeUnit unit) throws InterruptedException Description copied from interface:RPermitExpirableSemaphore
Tries to acquire defined amount of currently availablepermits
with definedleaseTime
and return ids. Waits up to definedwaitTime
if necessary until enough permits became available.- Specified by:
tryAcquire
in interfaceRPermitExpirableSemaphore
- Parameters:
permits
- the number of permits to acquirewaitTime
- the maximum time to waitleaseTime
- permit lease time, use -1 to make it permanentunit
- the time unit- Returns:
- permits ids if permits were acquired and empty collection if the waiting time elapsed before permits were acquired
- Throws:
InterruptedException
- if the current thread is interrupted
-
tryAcquireAsync
public RFuture<List<String>> tryAcquireAsync(int permits, long waitTime, long leaseTime, TimeUnit timeUnit) Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to acquire defined amount of currently availablepermits
with definedleaseTime
and returns their ids. Waits up to definedwaitTime
if necessary until permits became available.- Specified by:
tryAcquireAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permits
- the number of permits to acquirewaitTime
- the maximum time to waitleaseTime
- permit lease time, use -1 to make it permanenttimeUnit
- the time unit- Returns:
- permits ids if permits were acquired and empty list if the waiting time elapsed before permit were acquired
-
tryAcquire
Description copied from interface:RPermitExpirableSemaphore
Tries to acquire currently available permit and return its id. Waits up to definedwaitTime
if necessary until a permit became available.- Specified by:
tryAcquire
in interfaceRPermitExpirableSemaphore
- Parameters:
waitTime
- the maximum time to waitunit
- the time unit- Returns:
- permit id if a permit was acquired and
null
if the waiting time elapsed before a permit was acquired - Throws:
InterruptedException
- if the current thread is interrupted
-
release
Description copied from interface:RPermitExpirableSemaphore
Releases a permit by its id. Increases the number of available permits. Throws an exception if permit id doesn't exist or has already been released.- Specified by:
release
in interfaceRPermitExpirableSemaphore
- Parameters:
permitId
- - permit id
-
release
Description copied from interface:RPermitExpirableSemaphore
Releases permits by their ids. Increases the number of available permits. Throws an exception if permit id doesn't exist or has already been released.- Specified by:
release
in interfaceRPermitExpirableSemaphore
- Parameters:
permitsIds
- - permits ids
-
tryRelease
Description copied from interface:RPermitExpirableSemaphore
Tries to release permit by its id.- Specified by:
tryRelease
in interfaceRPermitExpirableSemaphore
- Parameters:
permitId
- permit id- Returns:
true
if a permit has been released andfalse
otherwise
-
tryRelease
Description copied from interface:RPermitExpirableSemaphore
Tries to release permits by their ids.- Specified by:
tryRelease
in interfaceRPermitExpirableSemaphore
- Parameters:
permitsIds
- - permits ids- Returns:
- amount of released permits
-
tryReleaseAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to release permit by its id.- Specified by:
tryReleaseAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permitId
- permit id- Returns:
true
if a permit has been released andfalse
otherwise
-
tryReleaseAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to release defined permits by their ids.- Specified by:
tryReleaseAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permitsIds
- - permits ids- Returns:
- amount of released permits
-
sizeInMemoryAsync
Description copied from interface:RObjectAsync
Returns bytes amount used by object in Redis memory.- Specified by:
sizeInMemoryAsync
in interfaceRObjectAsync
- Overrides:
sizeInMemoryAsync
in classRedissonObject
- Returns:
- size in bytes
-
deleteAsync
Description copied from interface:RObjectAsync
Delete object in async mode- Specified by:
deleteAsync
in interfaceRObjectAsync
- Overrides:
deleteAsync
in classRedissonObject
- Returns:
true
if object was deletedfalse
if not
-
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
-
releaseAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Releases a permit by its id. Increases the number of available permits. Throws an exception if permit id doesn't exist or has already been released.- Specified by:
releaseAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permitId
- - permit id- Returns:
- void
-
releaseAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Releases permits by their ids. Increases the number of available permits. Throws an exception if permits ids don't exist or have already been released.- Specified by:
releaseAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permitsIds
- - permit id
-
availablePermits
public int availablePermits()Description copied from interface:RPermitExpirableSemaphore
Returns number of available permits.- Specified by:
availablePermits
in interfaceRPermitExpirableSemaphore
- Returns:
- number of available permits
-
getPermits
public int getPermits()Description copied from interface:RPermitExpirableSemaphore
Returns the number of permits.- Specified by:
getPermits
in interfaceRPermitExpirableSemaphore
- Returns:
- number of permits
-
acquiredPermits
public int acquiredPermits()Description copied from interface:RPermitExpirableSemaphore
Returns the number of acquired permits.- Specified by:
acquiredPermits
in interfaceRPermitExpirableSemaphore
- Returns:
- number of acquired permits
-
availablePermitsAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Returns number of available permits.- Specified by:
availablePermitsAsync
in interfaceRPermitExpirableSemaphoreAsync
- Returns:
- number of permits
-
getPermitsAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Returns the number of permits.- Specified by:
getPermitsAsync
in interfaceRPermitExpirableSemaphoreAsync
- Returns:
- number of permits
-
acquiredPermitsAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Returns the number of acquired permits.- Specified by:
acquiredPermitsAsync
in interfaceRPermitExpirableSemaphoreAsync
- Returns:
- number of acquired permits
-
trySetPermits
public boolean trySetPermits(int permits) Description copied from interface:RPermitExpirableSemaphore
Tries to set the initial number of available permits.- Specified by:
trySetPermits
in interfaceRPermitExpirableSemaphore
- Parameters:
permits
- - number of permits- Returns:
true
if permits has been set successfully, otherwisefalse
.
-
setPermits
public void setPermits(int permits) Description copied from interface:RPermitExpirableSemaphore
Sets the number of permits to the provided value. Calculates thedelta
between the givenpermits
value and the current number of permits, then increases the number of available permits bydelta
.- Specified by:
setPermits
in interfaceRPermitExpirableSemaphore
- Parameters:
permits
- - number of permits
-
setPermitsAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Sets the number of permits to the provided value. Calculates thedelta
between the givenpermits
value and the current number of permits, then increases the number of available permits bydelta
.- Specified by:
setPermitsAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permits
- - number of permits
-
trySetPermitsAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Tries to set number of available permits.- Specified by:
trySetPermitsAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permits
- - number of permits- Returns:
true
if permits has been set successfully, otherwisefalse
.
-
addPermits
public void addPermits(int permits) Description copied from interface:RPermitExpirableSemaphore
Increases or decreases the number of available permits by defined value.- Specified by:
addPermits
in interfaceRPermitExpirableSemaphore
- Parameters:
permits
- amount of permits to add/remove
-
addPermitsAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Increases or decreases the number of available permits by defined value.- Specified by:
addPermitsAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permits
- amount of permits to add/remove- Returns:
- void
-
updateLeaseTimeAsync
Description copied from interface:RPermitExpirableSemaphoreAsync
Overrides and updates lease time for defined permit id.- Specified by:
updateLeaseTimeAsync
in interfaceRPermitExpirableSemaphoreAsync
- Parameters:
permitId
- permit idleaseTime
- permit lease time, use -1 to make it permanentunit
- the time unit- Returns:
true
if permits has been updated successfully, otherwisefalse
.
-
updateLeaseTime
Description copied from interface:RPermitExpirableSemaphore
Overrides and updates lease time for defined permit id.- Specified by:
updateLeaseTime
in interfaceRPermitExpirableSemaphore
- Parameters:
permitId
- permit idleaseTime
- permit lease time, use -1 to make it permanentunit
- the time unit- Returns:
true
if permits has been updated successfully, otherwisefalse
.
-
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
-