Class RedissonRateLimiter
- All Implemented Interfaces:
RExpirable,RExpirableAsync,RObject,RObjectAsync,RRateLimiter,RRateLimiterAsync
- Author:
- Nikita Koksharov
-
Field Summary
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacquire()Acquires a permit from this RateLimiter, blocking until one is available.voidacquire(long permits) Acquires a specifiedpermitsfrom this RateLimiter, blocking until one is available.Acquires a permit from this RateLimiter, blocking until one is available.acquireAsync(long permits) Acquires a specifiedpermitsfrom this RateLimiter, blocking until one is available.longReturns amount of available permits.Returns amount of available permits.booleanClear 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 modebooleanUseRExpirable.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.Returns current configuration of this RateLimiter object.Returns current configuration of this RateLimiter object.longExpiration time of Redisson object that has a timeoutExpiration time of Redisson object that has a timeoutlongRemaining time to live of Redisson object that has a timeoutRemaining time to live of Redisson object that has a timeoutvoidsetRate(RateType type, long rate, long rateInterval, RateIntervalUnit unit) Sets the rate limit and clears state.setRateAsync(RateType type, long rate, long rateInterval, RateIntervalUnit unit) Sets the rate limit and clears state.booleanAcquires a permit only if one is available at the time of invocation.booleantryAcquire(long permits) Acquires the given number ofpermitsonly if all are available at the time of invocation.booleantryAcquire(long permits, long timeout, TimeUnit unit) Acquires the given number ofpermitsonly if all are available within the given waiting time.booleantryAcquire(long timeout, TimeUnit unit) Acquires a permit from this RateLimiter, if one becomes available within the given waiting time.Acquires a permit only if one is available at the time of invocation.tryAcquireAsync(long permits) Acquires the given number ofpermitsonly if all are available at the time of invocation.tryAcquireAsync(long permits, long timeout, TimeUnit unit) Acquires the given number ofpermitsonly if all are available within the given waiting time.tryAcquireAsync(long timeout, TimeUnit unit) Acquires a permit from this RateLimiter, if one becomes available within the given waiting time.booleantrySetRate(RateType type, long rate, long rateInterval, RateIntervalUnit unit) Sets the rate limit only if it hasn't been set before.trySetRateAsync(RateType type, long rate, long rateInterval, RateIntervalUnit unit) Sets the rate limit only if it hasn't been set before.Methods inherited from class org.redisson.RedissonObject
addListener, addListener, addListenerAsync, addListenerAsync, addTrackingListener, addTrackingListenerAsync, checkNotBatch, 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, mapName, 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, 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.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLiveMethods inherited from interface org.redisson.api.RExpirableAsync
expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsyncMethods 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, unlinkMethods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Constructor Details
-
RedissonRateLimiter
-
-
Method Details
-
tryAcquire
public boolean tryAcquire()Description copied from interface:RRateLimiterAcquires a permit only if one is available at the time of invocation.Acquires a permit, if one is available and returns immediately, with the value
true, reducing the number of available permits by one.If no permit is available then this method will return immediately with the value
false.- Specified by:
tryAcquirein interfaceRRateLimiter- Returns:
trueif a permit was acquired andfalseotherwise
-
tryAcquireAsync
Description copied from interface:RRateLimiterAsyncAcquires a permit only if one is available at the time of invocation.Acquires a permit, if one is available and returns immediately, with the value
true, reducing the number of available permits by one.If no permit is available then this method will return immediately with the value
false.- Specified by:
tryAcquireAsyncin interfaceRRateLimiterAsync- Returns:
trueif a permit was acquired andfalseotherwise
-
tryAcquire
public boolean tryAcquire(long permits) Description copied from interface:RRateLimiterAcquires the given number ofpermitsonly if all are available at the time of invocation.Acquires a permits, if all are available and returns immediately, with the value
true, reducing the number of available permits by given number of permits.If no permits are available then this method will return immediately with the value
false.- Specified by:
tryAcquirein interfaceRRateLimiter- Parameters:
permits- the number of permits to acquire- Returns:
trueif a permit was acquired andfalseotherwise
-
tryAcquireAsync
Description copied from interface:RRateLimiterAsyncAcquires the given number ofpermitsonly if all are available at the time of invocation.Acquires a permits, if all are available and returns immediately, with the value
true, reducing the number of available permits by given number of permits.If no permits are available then this method will return immediately with the value
false.- Specified by:
tryAcquireAsyncin interfaceRRateLimiterAsync- Parameters:
permits- the number of permits to acquire- Returns:
trueif a permit was acquired andfalseotherwise
-
acquire
public void acquire()Description copied from interface:RRateLimiterAcquires a permit from this RateLimiter, blocking until one is available.Acquires a permit, if one is available and returns immediately, reducing the number of available permits by one.
- Specified by:
acquirein interfaceRRateLimiter
-
acquireAsync
Description copied from interface:RRateLimiterAsyncAcquires a permit from this RateLimiter, blocking until one is available.Acquires a permit, if one is available and returns immediately, reducing the number of available permits by one.
- Specified by:
acquireAsyncin interfaceRRateLimiterAsync- Returns:
- void
-
acquire
public void acquire(long permits) Description copied from interface:RRateLimiterAcquires a specifiedpermitsfrom this RateLimiter, blocking until one is available.Acquires the given number of permits, if they are available and returns immediately, reducing the number of available permits by the given amount.
- Specified by:
acquirein interfaceRRateLimiter- Parameters:
permits- the number of permits to acquire
-
acquireAsync
Description copied from interface:RRateLimiterAsyncAcquires a specifiedpermitsfrom this RateLimiter, blocking until one is available.Acquires the given number of permits, if they are available and returns immediately, reducing the number of available permits by the given amount.
- Specified by:
acquireAsyncin interfaceRRateLimiterAsync- Parameters:
permits- the number of permits to acquire- Returns:
- void
-
tryAcquire
Description copied from interface:RRateLimiterAcquires a permit from this RateLimiter, if one becomes available within the given waiting time.Acquires a permit, if one is available and returns immediately, with the value
true, reducing the number of available permits by one.If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until specified waiting time elapses.
If a permit is acquired then the value
trueis returned.If the specified waiting time elapses then the value
falseis returned. If the time is less than or equal to zero, the method will not wait at all.- Specified by:
tryAcquirein interfaceRRateLimiter- Parameters:
timeout- the maximum time to wait for a permitunit- the time unit of thetimeoutargument- Returns:
trueif a permit was acquired andfalseif the waiting time elapsed before a permit was acquired
-
tryAcquireAsync
Description copied from interface:RRateLimiterAsyncAcquires a permit from this RateLimiter, if one becomes available within the given waiting time.Acquires a permit, if one is available and returns immediately, with the value
true, reducing the number of available permits by one.If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until specified waiting time elapses.
If a permit is acquired then the value
trueis returned.If the specified waiting time elapses then the value
falseis returned. If the time is less than or equal to zero, the method will not wait at all.- Specified by:
tryAcquireAsyncin interfaceRRateLimiterAsync- Parameters:
timeout- the maximum time to wait for a permitunit- the time unit of thetimeoutargument- Returns:
trueif a permit was acquired andfalseif the waiting time elapsed before a permit was acquired
-
tryAcquire
Description copied from interface:RRateLimiterAcquires the given number ofpermitsonly if all are available within the given waiting time.Acquires the given number of permits, if all are available and returns immediately, with the value
true, reducing the number of available permits by one.If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the specified waiting time elapses.
If a permits is acquired then the value
trueis returned.If the specified waiting time elapses then the value
falseis returned. If the time is less than or equal to zero, the method will not wait at all.- Specified by:
tryAcquirein interfaceRRateLimiter- Parameters:
permits- amounttimeout- the maximum time to wait for a permitunit- the time unit of thetimeoutargument- Returns:
trueif a permit was acquired andfalseif the waiting time elapsed before a permit was acquired
-
tryAcquireAsync
Description copied from interface:RRateLimiterAsyncAcquires the given number ofpermitsonly if all are available within the given waiting time.Acquires the given number of permits, if all are available and returns immediately, with the value
true, reducing the number of available permits by one.If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the specified waiting time elapses.
If a permits is acquired then the value
trueis returned.If the specified waiting time elapses then the value
falseis returned. If the time is less than or equal to zero, the method will not wait at all.- Specified by:
tryAcquireAsyncin interfaceRRateLimiterAsync- Parameters:
permits- amounttimeout- the maximum time to wait for a permitunit- the time unit of thetimeoutargument- Returns:
trueif a permit was acquired andfalseif the waiting time elapsed before a permit was acquired
-
trySetRate
Description copied from interface:RRateLimiterSets the rate limit only if it hasn't been set before.- Specified by:
trySetRatein interfaceRRateLimiter- Parameters:
type- rate moderate- raterateInterval- rate time intervalunit- rate time interval unit- Returns:
trueif rate was set andfalseotherwise
-
trySetRateAsync
public RFuture<Boolean> trySetRateAsync(RateType type, long rate, long rateInterval, RateIntervalUnit unit) Description copied from interface:RRateLimiterAsyncSets the rate limit only if it hasn't been set before.- Specified by:
trySetRateAsyncin interfaceRRateLimiterAsync- Parameters:
type- rate moderate- raterateInterval- rate time intervalunit- rate time interval unit- Returns:
trueif rate was set andfalseotherwise
-
setRate
Description copied from interface:RRateLimiterSets the rate limit and clears state. Overrides both limit and state if they haven't been set before.- Specified by:
setRatein interfaceRRateLimiter- Parameters:
type- rate moderate- raterateInterval- rate time intervalunit- rate time interval unit
-
setRateAsync
public RFuture<Void> setRateAsync(RateType type, long rate, long rateInterval, RateIntervalUnit unit) Description copied from interface:RRateLimiterAsyncSets the rate limit and clears state. Overrides both limit and state if they haven't been set before.- Specified by:
setRateAsyncin interfaceRRateLimiterAsync- Parameters:
type- rate moderate- raterateInterval- rate time intervalunit- rate time interval unit- Returns:
trueif rate was set andfalseotherwise
-
getConfig
Description copied from interface:RRateLimiterReturns current configuration of this RateLimiter object.- Specified by:
getConfigin interfaceRRateLimiter- Returns:
- config object
-
getConfigAsync
Description copied from interface:RRateLimiterAsyncReturns current configuration of this RateLimiter object.- Specified by:
getConfigAsyncin interfaceRRateLimiterAsync- Returns:
- config object
-
availablePermits
public long availablePermits()Description copied from interface:RRateLimiterReturns amount of available permits.- Specified by:
availablePermitsin interfaceRRateLimiter- Returns:
- number of permits
-
availablePermitsAsync
Description copied from interface:RRateLimiterAsyncReturns amount of available permits.- Specified by:
availablePermitsAsyncin interfaceRRateLimiterAsync- Returns:
- number of permits
-
expireAsync
-
expireAtAsync
-
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
-
deleteAsync
Description copied from interface:RObjectAsyncDelete object in async mode- Specified by:
deleteAsyncin interfaceRObjectAsync- Overrides:
deleteAsyncin classRedissonObject- Returns:
trueif object was deletedfalseif not
-
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
-
remainTimeToLive
public long remainTimeToLive()Description copied from interface:RExpirableRemaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLivein 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:RExpirableAsyncRemaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsyncin 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:RExpirableExpiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTimein interfaceRExpirable- Returns:
- expiration time
-
getExpireTimeAsync
Description copied from interface:RExpirableAsyncExpiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTimeAsyncin interfaceRExpirableAsync- Returns:
- expiration time
-
clearExpireAsync
-