Package org.redisson

Class RedissonLocalCachedMap<K,V>

java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonMap<K,V>
org.redisson.RedissonLocalCachedMap<K,V>
All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K,V>, RDestroyable, RExpirable, RExpirableAsync, RLocalCachedMap<K,V>, RMap<K,V>, RMapAsync<K,V>, RObject, RObjectAsync

public class RedissonLocalCachedMap<K,V> extends RedissonMap<K,V> implements RLocalCachedMap<K,V>
  • Field Details

  • Constructor Details

  • Method Details

    • getLocalCacheView

      public LocalCacheView<K,V> getLocalCacheView()
    • sizeAsync

      public RFuture<Integer> sizeAsync()
      Description copied from interface: RMapAsync
      Returns size of this map
      Specified by:
      sizeAsync in interface RMapAsync<K,V>
      Overrides:
      sizeAsync in class RedissonMap<K,V>
      Returns:
      size
    • 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 RedissonMap<K,V>
      Parameters:
      value - - map value
      Returns:
      true if this map contains any map entry with specified value, otherwise false
    • getAsync

      protected RFuture<V> getAsync(K key, long threadId)
      Overrides:
      getAsync in class RedissonMap<K,V>
    • generateLogEntryId

      protected static byte[] generateLogEntryId(byte[] keyHash)
    • putOperationAsync

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

      protected io.netty.buffer.ByteBuf createSyncMessage(io.netty.buffer.ByteBuf mapKey, io.netty.buffer.ByteBuf mapValue, CacheKey cacheKey)
    • fastPutOperationAsync

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

      public void destroy()
      Description copied from interface: RDestroyable
      Destroys object when it's not necessary anymore.
      Specified by:
      destroy in interface RDestroyable
      Overrides:
      destroy in class RedissonMap<K,V>
    • removeOperationAsync

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

      protected RFuture<List<Long>> fastRemoveOperationBatchAsync(K... keys)
      Overrides:
      fastRemoveOperationBatchAsync in class RedissonMap<K,V>
    • fastRemoveOperationAsync

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

      public RFuture<Long> sizeInMemoryAsync()
      Description copied from interface: RObjectAsync
      Returns bytes amount used by object in Redis memory.
      Specified by:
      sizeInMemoryAsync in interface RObjectAsync
      Overrides:
      sizeInMemoryAsync in class RedissonObject
      Returns:
      size in bytes
    • 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 RedissonObject
      Returns:
      true if object was deleted false if not
    • getAllAsync

      public RFuture<Map<K,V>> getAllAsync(Set<K> keys)
      Description copied from interface: RMapAsync
      Returns map slice contained the mappings with defined keys.

      If map doesn't contain value/values for specified key/keys and MapLoader is defined then value/values will be loaded in read-through mode.

      The returned map is NOT backed by the original map.

      Specified by:
      getAllAsync in interface RMapAsync<K,V>
      Overrides:
      getAllAsync in class RedissonMap<K,V>
      Parameters:
      keys - - map keys
      Returns:
      Map slice
    • putAllOperationAsync

      protected RFuture<Void> putAllOperationAsync(Map<? extends K,? extends V> map)
      Overrides:
      putAllOperationAsync in class RedissonMap<K,V>
    • addAndGetOperationAsync

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

      public RFuture<Boolean> fastPutIfAbsentAsync(K key, V value)
      Description copied from interface: RMapAsync
      Stores the specified value mapped by specified key only if there is no value with specifiedkey stored before.

      Returns true if key is a new one in the hash and value was set or false if key already exists in the hash and change hasn't been made.

      Works faster than RMapAsync.putIfAbsentAsync(Object, Object) but not returning the previous value associated with key

      If MapWriter is defined then new map entry is stored in write-through mode.

      Specified by:
      fastPutIfAbsentAsync in interface RMapAsync<K,V>
      Overrides:
      fastPutIfAbsentAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if key is a new one in the hash and value was set. false if key already exists in the hash and change hasn't been made.
    • fastPutIfExistsAsync

      public RFuture<Boolean> fastPutIfExistsAsync(K key, V value)
      Description copied from interface: RMapAsync
      Stores the specified value mapped by key only if mapping already exists.

      Returns true if key is a new one in the hash and value was set or false if key already exists in the hash and change hasn't been made.

      Works faster than RMapAsync.putIfExistsAsync(Object, Object) but doesn't return previous value associated with key

      If MapWriter is defined then new map entry is stored in write-through mode.

      Specified by:
      fastPutIfExistsAsync in interface RMapAsync<K,V>
      Overrides:
      fastPutIfExistsAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if key already exists in the hash and new value has been stored. false if key doesn't exist in the hash and value hasn't been set.
    • 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 RedissonMap<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 RedissonMap<K,V>
      Returns:
      map
    • preloadCache

      public void preloadCache()
      Description copied from interface: RLocalCachedMap
      Pre-warm the cached entries. Not guaranteed to load ALL values, but statistically will preload approximately all (all if no concurrent mutating activity). Entries are loaded in a batch with size of 10 elements.
      Specified by:
      preloadCache in interface RLocalCachedMap<K,V>
    • preloadCache

      public void preloadCache(int count)
      Description copied from interface: RLocalCachedMap
      Pre-warm the cached entries. Not guaranteed to load ALL values, but statistically will preload approximately all (all if no concurrent mutating activity) Entries are loaded in a batch. Batch size is defined by count param.
      Specified by:
      preloadCache in interface RLocalCachedMap<K,V>
      Parameters:
      count - - size of batch
    • clearLocalCache

      public void clearLocalCache()
      Description copied from interface: RLocalCachedMap
      Clears local cache across all instances
      Specified by:
      clearLocalCache in interface RLocalCachedMap<K,V>
    • clearLocalCacheAsync

      public RFuture<Void> clearLocalCacheAsync()
      Description copied from interface: RLocalCachedMap
      Clears local cache across all instances
      Specified by:
      clearLocalCacheAsync in interface RLocalCachedMap<K,V>
      Returns:
      void
    • 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 RedissonMap<K,V>
      Returns:
      entries
    • fastReplaceAsync

      public RFuture<Boolean> fastReplaceAsync(K key, V value)
      Description copied from interface: RMapAsync
      Replaces previous value with a new value mapped by specified key.

      Works faster than RMapAsync.replaceAsync(Object, Object) but not returning the previous value.

      Returns true if key exists and value was updated or false if key doesn't exists and value wasn't updated.

      If MapWriter is defined then new map entry is stored in write-through mode.

      Specified by:
      fastReplaceAsync in interface RMapAsync<K,V>
      Overrides:
      fastReplaceAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if key exists and value was updated. false if key doesn't exists and value wasn't updated.
    • fastReplaceOperationAsync

      protected RFuture<Boolean> fastReplaceOperationAsync(K key, V value)
      Overrides:
      fastReplaceOperationAsync in class RedissonMap<K,V>
    • replaceOperationAsync

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

      public RFuture<V> replaceAsync(K key, V value)
      Description copied from interface: RMapAsync
      Replaces previous value with a new value mapped by specified key. Returns null if there is no map entry stored before and doesn't store new map entry.

      If MapWriter is defined then new valueis written in write-through mode.

      Specified by:
      replaceAsync in interface RMapAsync<K,V>
      Overrides:
      replaceAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      previous associated value or null if there is no map entry stored before and doesn't store new map entry
    • replaceOperationAsync

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

      public RFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
      Description copied from interface: RMapAsync
      Replaces previous oldValue with a newValue mapped by specified key. Returns false if previous value doesn't exist or equal to oldValue.

      If MapWriter is defined then newValueis written in write-through mode.

      Specified by:
      replaceAsync in interface RMapAsync<K,V>
      Overrides:
      replaceAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      oldValue - - map old value
      newValue - - map new value
      Returns:
      true if value has been replaced otherwise false.
    • removeOperationAsync

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

      public RFuture<Boolean> removeAsync(Object key, Object value)
      Description copied from interface: RMapAsync
      Removes map entry only if it exists with specified key and value.

      If MapWriter is defined then keyis deleted in write-through mode.

      Specified by:
      removeAsync in interface RMapAsync<K,V>
      Overrides:
      removeAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if map entry has been removed otherwise false.
    • putIfExistsAsync

      public RFuture<V> putIfExistsAsync(K key, V value)
      Description copied from interface: RMapAsync
      Stores the specified value mapped by key only if mapping already exists.

      If MapWriter is defined then new map entry is stored in write-through mode.

      Specified by:
      putIfExistsAsync in interface RMapAsync<K,V>
      Overrides:
      putIfExistsAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      null if key is doesn't exists in the hash and value hasn't been set. Previous value if key already exists in the hash and new value has been stored.
    • putIfAbsentAsync

      public RFuture<V> putIfAbsentAsync(K key, V value)
      Description copied from interface: RMapAsync
      Stores the specified value mapped by specified key only if there is no value with specifiedkey stored before.

      If MapWriter is defined then new map entry is stored in write-through mode.

      Specified by:
      putIfAbsentAsync in interface RMapAsync<K,V>
      Overrides:
      putIfAbsentAsync in class RedissonMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      null if key is a new one in the hash and value was set. Previous value if key already exists in the hash and change hasn't been made.
    • encode

      public io.netty.buffer.ByteBuf encode(Object value)
      Overrides:
      encode in class RedissonObject
    • cachedKeySet

      public Set<K> cachedKeySet()
      Description copied from interface: RLocalCachedMap
      Returns all keys stored in local cache
      Specified by:
      cachedKeySet in interface RLocalCachedMap<K,V>
      Returns:
      keys
    • cachedValues

      public Collection<V> cachedValues()
      Description copied from interface: RLocalCachedMap
      Returns all values stored in local cache
      Specified by:
      cachedValues in interface RLocalCachedMap<K,V>
      Returns:
      values
    • cachedEntrySet

      public Set<Map.Entry<K,V>> cachedEntrySet()
      Description copied from interface: RLocalCachedMap
      Returns all map entries stored in local cache
      Specified by:
      cachedEntrySet in interface RLocalCachedMap<K,V>
      Returns:
      entries
    • getCachedMap

      public Map<K,V> getCachedMap()
      Description copied from interface: RLocalCachedMap
      Returns state of local cache
      Specified by:
      getCachedMap in interface RLocalCachedMap<K,V>
      Returns:
      map
    • keySet

      public Set<K> keySet(String pattern, int count)
      Description copied from interface: RMap
      Returns key set of this map. If pattern is not null then only keys match this pattern are loaded. Keys are loaded in batch. Batch size is defined by count param.

      Use org.redisson.client.codec.StringCodec for Map keys.

      Supported glob-style patterns:

      h?llo subscribes to hello, hallo and hxllo

      h*llo subscribes to hllo and heeeello

      h[ae]llo subscribes to hello and hallo, but not hillo

      Specified by:
      keySet in interface RMap<K,V>
      Overrides:
      keySet in class RedissonMap<K,V>
      Parameters:
      pattern - - key pattern
      count - - size of keys batch
      Returns:
      key set
      See Also:
    • values

      public Collection<V> values(String keyPattern, int count)
      Description copied from interface: RMap
      Returns values collection of this map. Values are loaded in batch. Batch size is defined by count param. If keyPattern is not null then only values mapped by matched keys of this pattern are loaded.

      Use org.redisson.client.codec.StringCodec for Map keys.

      Supported glob-style patterns:

      h?llo subscribes to hello, hallo and hxllo

      h*llo subscribes to hllo and heeeello

      h[ae]llo subscribes to hello and hallo, but not hillo

      Specified by:
      values in interface RMap<K,V>
      Overrides:
      values in class RedissonMap<K,V>
      Parameters:
      keyPattern - - key pattern
      count - - size of values batch
      Returns:
      values collection
      See Also:
    • entrySet

      public Set<Map.Entry<K,V>> entrySet(String keyPattern, int count)
      Description copied from interface: RMap
      Returns map entries collection. Map entries are loaded in batch. Batch size is defined by count param. If keyPattern is not null then only entries mapped by matched keys of this pattern are loaded. Supported glob-style patterns:

      h?llo subscribes to hello, hallo and hxllo

      h*llo subscribes to hllo and heeeello

      h[ae]llo subscribes to hello and hallo, but not hillo

      Specified by:
      entrySet in interface RMap<K,V>
      Overrides:
      entrySet in class RedissonMap<K,V>
      Parameters:
      keyPattern - - key pattern
      count - - size of entries batch
      Returns:
      map entries collection
      See Also:
    • addListener

      public int addListener(ObjectListener listener)
      Description copied from interface: RObject
      Adds object event listener
      Specified by:
      addListener in interface RLocalCachedMap<K,V>
      Specified by:
      addListener in interface RMap<K,V>
      Specified by:
      addListener in interface RObject
      Overrides:
      addListener in class RedissonMap<K,V>
      Parameters:
      listener - - object event listener
      Returns:
      listener id
      See Also:
    • addListenerAsync

      public RFuture<Integer> addListenerAsync(ObjectListener listener)
      Description copied from interface: RObjectAsync
      Adds object event listener
      Specified by:
      addListenerAsync in interface RMapAsync<K,V>
      Specified by:
      addListenerAsync in interface RObjectAsync
      Overrides:
      addListenerAsync in class RedissonMap<K,V>
      Parameters:
      listener - - object event listener
      Returns:
      listener id
      See Also:
    • removeListener

      public void removeListener(int listenerId)
      Description copied from interface: RObject
      Removes object event listener
      Specified by:
      removeListener in interface RObject
      Overrides:
      removeListener in class RedissonObject
      Parameters:
      listenerId - - listener id
    • removeListenerAsync

      public RFuture<Void> removeListenerAsync(int listenerId)
      Description copied from interface: RObjectAsync
      Removes object event listener
      Specified by:
      removeListenerAsync in interface RObjectAsync
      Overrides:
      removeListenerAsync in class RedissonObject
      Parameters:
      listenerId - - listener id
    • 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
    • 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
      Returns:
      true if the timeout was cleared and false if not
    • 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.
    • 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.
    • 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
    • expireAsync

      protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param, String... keys)
    • expireAtAsync

      protected RFuture<Boolean> expireAtAsync(long timestamp, String param, String... keys)
    • clearExpireAsync

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