Class RedissonTransactionalMapCache<K,V>

java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonMap<K,V>
org.redisson.RedissonMapCache<K,V>
org.redisson.transaction.RedissonTransactionalMapCache<K,V>
Type Parameters:
K - key type
V - value type
All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K,V>, RDestroyable, RExpirable, RExpirableAsync, RMap<K,V>, RMapAsync<K,V>, RMapCache<K,V>, RMapCacheAsync<K,V>, RObject, RObjectAsync

public class RedissonTransactionalMapCache<K,V> extends RedissonMapCache<K,V>
Author:
Nikita Koksharov
  • Constructor Details

  • Method Details

    • expireAsync

      public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param, String... keys)
      Overrides:
      expireAsync in class RedissonMapCache<K,V>
    • expireAtAsync

      protected RFuture<Boolean> expireAtAsync(long timestamp, String param, String... keys)
      Overrides:
      expireAtAsync in class RedissonMapCache<K,V>
    • clearExpireAsync

      public RFuture<Boolean> 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 interface RExpirableAsync
      Overrides:
      clearExpireAsync in class RedissonMapCache<K,V>
      Returns:
      true if the timeout was cleared and false if not
    • moveAsync

      public RFuture<Boolean> moveAsync(int database)
      Description copied from interface: RObjectAsync
      Move object to another database in async mode
      Specified by:
      moveAsync in interface RObjectAsync
      Overrides:
      moveAsync in class RedissonObject
      Parameters:
      database - - number of Redis database
      Returns:
      true if key was moved false if not
    • migrateAsync

      public RFuture<Void> migrateAsync(String host, int port, int database, long timeout)
      Description copied from interface: RObjectAsync
      Transfer object from source Redis instance to destination Redis instance in async mode
      Specified by:
      migrateAsync in interface RObjectAsync
      Overrides:
      migrateAsync in class RedissonObject
      Parameters:
      host - - destination host
      port - - destination port
      database - - destination database
      timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
      Returns:
      void
    • touchAsync

      public RFuture<Boolean> touchAsync()
      Description copied from interface: RObjectAsync
      Update the last access time of an object in async mode.
      Specified by:
      touchAsync in interface RObjectAsync
      Overrides:
      touchAsync in class RedissonObject
      Returns:
      true if object was touched else false
    • isExistsAsync

      public RFuture<Boolean> isExistsAsync()
      Description copied from interface: RObjectAsync
      Check object existence in async mode.
      Specified by:
      isExistsAsync in interface RObjectAsync
      Overrides:
      isExistsAsync in class RedissonObject
      Returns:
      true if object exists and false otherwise
    • unlinkAsync

      public RFuture<Boolean> unlinkAsync()
      Description copied from interface: RObjectAsync
      Delete the objects. Actual removal will happen later asynchronously.

      Requires Redis 4.0+

      Specified by:
      unlinkAsync in interface RObjectAsync
      Overrides:
      unlinkAsync in class RedissonObject
      Returns:
      true if it was exist and deleted else false
    • deleteAsync

      public RFuture<Boolean> deleteAsync()
      Description copied from interface: RObjectAsync
      Delete object in async mode
      Specified by:
      deleteAsync in interface RObjectAsync
      Overrides:
      deleteAsync in class RedissonMapCache<K,V>
      Returns:
      true if object was deleted false if not
    • putIfAbsentAsync

      public RFuture<V> putIfAbsentAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCacheAsync
      If the specified key is not already associated with a value, associate it with the given value.

      Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

      If the map previously contained a mapping for the key, the old value is replaced by the specified value.

      Specified by:
      putIfAbsentAsync in interface RMapCacheAsync<K,V>
      Overrides:
      putIfAbsentAsync in class RedissonMapCache<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
      ttlUnit - - time unit
      maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
      maxIdleUnit - - time unit

      if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

      Returns:
      previous associated value
    • fastPutOperationAsync

      public RFuture<Boolean> fastPutOperationAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Overrides:
      fastPutOperationAsync in class RedissonMapCache<K,V>
    • putOperationAsync

      public RFuture<V> putOperationAsync(K key, V value, long ttlTimeout, long maxIdleTimeout, long maxIdleDelta, long ttlTimeoutDelta)
      Overrides:
      putOperationAsync in class RedissonMapCache<K,V>
    • fastPutIfAbsentAsync

      public RFuture<Boolean> fastPutIfAbsentAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCacheAsync
      If the specified key is not already associated with a value, associate it with the given value.

      Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

      Works faster than usual RMapCacheAsync.putIfAbsentAsync(Object, Object, long, TimeUnit, long, TimeUnit) as it not returns previous value.

      Specified by:
      fastPutIfAbsentAsync in interface RMapCacheAsync<K,V>
      Overrides:
      fastPutIfAbsentAsync in class RedissonMapCache<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
      ttlUnit - - time unit
      maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
      maxIdleUnit - - time unit

      if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

      Returns:
      true if key is a new key in the hash and value was set. false if key already exists in the hash
    • remainTimeToLiveAsync

      public RFuture<Long> remainTimeToLiveAsync()
      Description copied from interface: RExpirableAsync
      Remaining time to live of Redisson object that has a timeout
      Specified by:
      remainTimeToLiveAsync in interface RExpirableAsync
      Returns:
      time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
    • setMaxSizeAsync

      public RFuture<Void> setMaxSizeAsync(int maxSize)
      Description copied from interface: RMapCacheAsync
      Sets max size of the map and overrides current value. Superfluous elements are evicted using LRU algorithm by default.
      Specified by:
      setMaxSizeAsync in interface RMapCacheAsync<K,V>
      Overrides:
      setMaxSizeAsync in class RedissonMapCache<K,V>
      Parameters:
      maxSize - - max size
      Returns:
      void
    • trySetMaxSizeAsync

      public RFuture<Boolean> trySetMaxSizeAsync(int maxSize)
      Description copied from interface: RMapCacheAsync
      Tries to set max size of the map. Superfluous elements are evicted using LRU algorithm by default.
      Specified by:
      trySetMaxSizeAsync in interface RMapCacheAsync<K,V>
      Overrides:
      trySetMaxSizeAsync in class RedissonMapCache<K,V>
      Parameters:
      maxSize - - max size
      Returns:
      true if max size has been successfully set, otherwise false.
    • mapReduce

      public <KOut, VOut> RMapReduce<K,V,KOut,VOut> mapReduce()
      Description copied from interface: RMap
      Returns RMapReduce object associated with this map
      Specified by:
      mapReduce in interface RMap<K,V>
      Overrides:
      mapReduce in class RedissonMap<K,V>
      Type Parameters:
      KOut - output key
      VOut - output value
      Returns:
      MapReduce instance
    • scanIterator

      public ScanResult<Map.Entry<Object,Object>> scanIterator(String name, RedisClient client, long startPos, String pattern, int count)
      Overrides:
      scanIterator in class RedissonMapCache<K,V>
    • containsKeyAsync

      public RFuture<Boolean> containsKeyAsync(Object key)
      Description copied from interface: RMapAsync
      Returns true if this map contains map entry mapped by specified key, otherwise false
      Specified by:
      containsKeyAsync in interface RMapAsync<K,V>
      Overrides:
      containsKeyAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      true if this map contains map entry mapped by specified key, otherwise false
    • containsValueAsync

      public RFuture<Boolean> containsValueAsync(Object value)
      Description copied from interface: RMapAsync
      Returns true if this map contains any map entry with specified value, otherwise false
      Specified by:
      containsValueAsync in interface RMapAsync<K,V>
      Overrides:
      containsValueAsync in class RedissonMapCache<K,V>
      Parameters:
      value - - map value
      Returns:
      true if this map contains any map entry with specified value, otherwise false
    • addAndGetOperationAsync

      protected RFuture<V> addAndGetOperationAsync(K key, Number value)
      Overrides:
      addAndGetOperationAsync in class RedissonMapCache<K,V>
    • fastPutIfExistsOperationAsync

      protected RFuture<Boolean> fastPutIfExistsOperationAsync(K key, V value)
      Overrides:
      fastPutIfExistsOperationAsync in class RedissonMapCache<K,V>
    • putIfExistsOperationAsync

      protected RFuture<V> putIfExistsOperationAsync(K key, V value)
      Overrides:
      putIfExistsOperationAsync in class RedissonMapCache<K,V>
    • putIfAbsentOperationAsync

      protected RFuture<V> putIfAbsentOperationAsync(K key, V value)
      Overrides:
      putIfAbsentOperationAsync in class RedissonMapCache<K,V>
    • putOperationAsync

      protected RFuture<V> putOperationAsync(K key, V value)
      Overrides:
      putOperationAsync in class RedissonMapCache<K,V>
    • fastPutIfAbsentOperationAsync

      protected RFuture<Boolean> fastPutIfAbsentOperationAsync(K key, V value)
      Overrides:
      fastPutIfAbsentOperationAsync in class RedissonMapCache<K,V>
    • fastPutOperationAsync

      protected RFuture<Boolean> fastPutOperationAsync(K key, V value)
      Overrides:
      fastPutOperationAsync in class RedissonMapCache<K,V>
    • fastRemoveOperationAsync

      protected RFuture<Long> fastRemoveOperationAsync(K... keys)
      Overrides:
      fastRemoveOperationAsync in class RedissonMapCache<K,V>
    • valueSizeAsync

      public RFuture<Integer> valueSizeAsync(K key)
      Description copied from interface: RMapAsync
      Returns size of value mapped by key in bytes
      Specified by:
      valueSizeAsync in interface RMapAsync<K,V>
      Overrides:
      valueSizeAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      size of value
    • getOperationAsync

      public RFuture<V> getOperationAsync(K key)
      Overrides:
      getOperationAsync in class RedissonMapCache<K,V>
    • readAllKeySetAsync

      public RFuture<Set<K>> readAllKeySetAsync()
      Description copied from interface: RMapAsync
      Read all keys at once
      Specified by:
      readAllKeySetAsync in interface RMapAsync<K,V>
      Overrides:
      readAllKeySetAsync in class RedissonMapCache<K,V>
      Returns:
      keys
    • readAllEntrySetAsync

      public RFuture<Set<Map.Entry<K,V>>> readAllEntrySetAsync()
      Description copied from interface: RMapAsync
      Read all map entries at once
      Specified by:
      readAllEntrySetAsync in interface RMapAsync<K,V>
      Overrides:
      readAllEntrySetAsync in class RedissonMapCache<K,V>
      Returns:
      entries
    • readAllValuesAsync

      public RFuture<Collection<V>> readAllValuesAsync()
      Description copied from interface: RMapAsync
      Read all values at once
      Specified by:
      readAllValuesAsync in interface RMapAsync<K,V>
      Overrides:
      readAllValuesAsync in class RedissonMapCache<K,V>
      Returns:
      values
    • readAllMapAsync

      public RFuture<Map<K,V>> readAllMapAsync()
      Description copied from interface: RMapAsync
      Read all map as local instance at once
      Specified by:
      readAllMapAsync in interface RMapAsync<K,V>
      Overrides:
      readAllMapAsync in class RedissonMapCache<K,V>
      Returns:
      map
    • getAllOperationAsync

      public RFuture<Map<K,V>> getAllOperationAsync(Set<K> keys)
      Overrides:
      getAllOperationAsync in class RedissonMapCache<K,V>
    • removeOperationAsync

      protected RFuture<V> removeOperationAsync(K key)
      Overrides:
      removeOperationAsync in class RedissonMapCache<K,V>
    • removeOperationAsync

      protected RFuture<Boolean> removeOperationAsync(Object key, Object value)
      Overrides:
      removeOperationAsync in class RedissonMapCache<K,V>
    • putAllOperationAsync

      protected RFuture<Void> putAllOperationAsync(Map<? extends K,? extends V> entries)
      Overrides:
      putAllOperationAsync in class RedissonMapCache<K,V>
    • replaceOperationAsync

      protected RFuture<Boolean> replaceOperationAsync(K key, V oldValue, V newValue)
      Overrides:
      replaceOperationAsync in class RedissonMapCache<K,V>
    • replaceOperationAsync

      protected RFuture<V> replaceOperationAsync(K key, V value)
      Overrides:
      replaceOperationAsync in class RedissonMapCache<K,V>
    • checkState

      protected void checkState()
    • loadAllAsync

      public RFuture<Void> loadAllAsync(boolean replaceExistingValues, int parallelism)
      Description copied from interface: RMapAsync
      Loads all map entries to this Redis map using MapLoader.
      Specified by:
      loadAllAsync in interface RMapAsync<K,V>
      Overrides:
      loadAllAsync in class RedissonMap<K,V>
      Parameters:
      replaceExistingValues - - true if existed values should be replaced, false otherwise.
      parallelism - - parallelism level, used to increase speed of process execution
      Returns:
      void
    • loadAllAsync

      public RFuture<Void> loadAllAsync(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
      Description copied from interface: RMapAsync
      Loads map entries using MapLoader whose keys are listed in defined keys parameter.
      Specified by:
      loadAllAsync in interface RMapAsync<K,V>
      Overrides:
      loadAllAsync in class RedissonMap<K,V>
      Parameters:
      keys - - map keys
      replaceExistingValues - - true if existed values should be replaced, false otherwise.
      parallelism - - parallelism level, used to increase speed of process execution
      Returns:
      void
    • getFairLock

      public RLock getFairLock(K key)
      Description copied from interface: RMap
      Returns RLock instance associated with key
      Specified by:
      getFairLock in interface RMap<K,V>
      Overrides:
      getFairLock in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      fairlock
    • getCountDownLatch

      public RCountDownLatch getCountDownLatch(K key)
      Description copied from interface: RMap
      Returns RCountDownLatch instance associated with key
      Specified by:
      getCountDownLatch in interface RMap<K,V>
      Overrides:
      getCountDownLatch in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      countdownlatch
    • getPermitExpirableSemaphore

      public RPermitExpirableSemaphore getPermitExpirableSemaphore(K key)
      Description copied from interface: RMap
      Returns RPermitExpirableSemaphore instance associated with key
      Specified by:
      getPermitExpirableSemaphore in interface RMap<K,V>
      Overrides:
      getPermitExpirableSemaphore in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      permitExpirableSemaphore
    • getSemaphore

      public RSemaphore getSemaphore(K key)
      Description copied from interface: RMap
      Returns RSemaphore instance associated with key
      Specified by:
      getSemaphore in interface RMap<K,V>
      Overrides:
      getSemaphore in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      semaphore
    • getLock

      public RLock getLock(K key)
      Description copied from interface: RMap
      Returns RLock instance associated with key
      Specified by:
      getLock in interface RMap<K,V>
      Overrides:
      getLock in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      lock
    • getReadWriteLock

      public RReadWriteLock getReadWriteLock(K key)
      Description copied from interface: RMap
      Returns RReadWriteLock instance associated with key
      Specified by:
      getReadWriteLock in interface RMap<K,V>
      Overrides:
      getReadWriteLock in class RedissonMap<K,V>
      Parameters:
      key - - map key
      Returns:
      readWriteLock
    • expire

      public boolean expire(long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RExpirable
      Specified by:
      expire in interface RExpirable
      Parameters:
      timeToLive - - timeout before object will be deleted
      timeUnit - - timeout time unit
      Returns:
      true if the timeout was set and false if not
    • expireAsync

      public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAsync in interface RExpirableAsync
      Parameters:
      timeToLive - - timeout before object will be deleted
      timeUnit - - timeout time unit
      Returns:
      true if the timeout was set and false if not
    • expireAt

      public boolean expireAt(long timestamp)
      Description copied from interface: RExpirable
      Specified by:
      expireAt in interface RExpirable
      Parameters:
      timestamp - - expire date in milliseconds (Unix timestamp)
      Returns:
      true if the timeout was set and false if not
    • expireAtAsync

      public RFuture<Boolean> expireAtAsync(long timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      Parameters:
      timestamp - - expire date in milliseconds (Unix timestamp)
      Returns:
      true if the timeout was set and false if not
    • expire

      public boolean expire(Instant instant)
      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 interface RExpirable
      Parameters:
      instant - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSet

      public boolean expireIfSet(Instant time)
      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 interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync

      public RFuture<Boolean> expireIfSetAsync(Instant time)
      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 interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet

      public boolean expireIfNotSet(Instant time)
      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 interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync

      public RFuture<Boolean> expireIfNotSetAsync(Instant time)
      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 interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater

      public boolean expireIfGreater(Instant time)
      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 interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync

      public RFuture<Boolean> expireIfGreaterAsync(Instant time)
      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 interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLess

      public boolean expireIfLess(Instant time)
      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 interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync

      public RFuture<Boolean> expireIfLessAsync(Instant time)
      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 interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireAsync

      public RFuture<Boolean> expireAsync(Instant instant)
      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 interface RExpirableAsync
      Parameters:
      instant - - expire date
      Returns:
      true if the timeout was set and false if not
    • expire

      public boolean expire(Duration duration)
      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 interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireAsync

      public RFuture<Boolean> expireAsync(Duration duration)
      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 interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireAt

      public boolean expireAt(Date timestamp)
      Description copied from interface: RExpirable
      Specified by:
      expireAt in interface RExpirable
      Parameters:
      timestamp - - expire date
      Returns:
      true if the timeout was set and false if not
    • expireAtAsync

      public RFuture<Boolean> expireAtAsync(Date timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      Parameters:
      timestamp - - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSet

      public boolean expireIfSet(Duration duration)
      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 interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync

      public RFuture<Boolean> expireIfSetAsync(Duration duration)
      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 interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet

      public boolean expireIfNotSet(Duration duration)
      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 interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync

      public RFuture<Boolean> expireIfNotSetAsync(Duration duration)
      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 interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater

      public boolean expireIfGreater(Duration duration)
      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 interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync

      public RFuture<Boolean> expireIfGreaterAsync(Duration duration)
      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 interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLess

      public boolean expireIfLess(Duration duration)
      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 interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync

      public RFuture<Boolean> expireIfLessAsync(Duration duration)
      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 interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • clearExpire

      public boolean clearExpire()
      Description copied from interface: RExpirable
      Clear an expire timeout or expire date for object.
      Specified by:
      clearExpire in interface RExpirable
      Returns:
      true if timeout was removed false 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 interface RExpirable
      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 timeout

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTime in interface RExpirable
      Returns:
      expiration time
    • getExpireTimeAsync

      public RFuture<Long> getExpireTimeAsync()
      Description copied from interface: RExpirableAsync
      Expiration time of Redisson object that has a timeout

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTimeAsync in interface RExpirableAsync
      Returns:
      expiration time
    • clearExpireAsync

      protected RFuture<Boolean> clearExpireAsync(String... keys)