Package org.redisson

Class RedissonMap<K,V>

java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonMap<K,V>
Type Parameters:
K - key
V - value
All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K,V>, RDestroyable, RExpirable, RExpirableAsync, RMap<K,V>, RMapAsync<K,V>, RObject, RObjectAsync
Direct Known Subclasses:
RedissonLocalCachedMap, RedissonMapCache, RedissonTransactionalMap

public class RedissonMap<K,V> extends RedissonObject implements RMap<K,V>
Distributed and concurrent implementation of ConcurrentMap and Map
Author:
Nikita Koksharov
  • Constructor Details

  • Method Details

    • 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>
      Type Parameters:
      KOut - output key
      VOut - output value
      Returns:
      MapReduce instance
    • 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>
      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>
      Parameters:
      key - - map key
      Returns:
      semaphore
    • 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>
      Parameters:
      key - - map key
      Returns:
      countdownlatch
    • 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>
      Parameters:
      key - - map key
      Returns:
      fairlock
    • 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>
      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>
      Parameters:
      key - - map key
      Returns:
      readWriteLock
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
    • merge

      public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
      Specified by:
      merge in interface ConcurrentMap<K,V>
      Specified by:
      merge in interface Map<K,V>
    • mergeAsync

      public RFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
      Description copied from interface: RMapAsync
      Associates specified key with the given value if key isn't already associated with a value. Otherwise, replaces the associated value with the results of the given remapping function, or removes if the result is null.
      Specified by:
      mergeAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      value - - value to be merged with the existing value associated with the key or to be associated with the key, if no existing value
      remappingFunction - - the function is invoked with the existing value to compute new value
      Returns:
      new value associated with the specified key or null if no value associated with the key
    • computeAsync

      public RFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
      Description copied from interface: RMapAsync
      Computes a new mapping for the specified key and its current mapped value.
      Specified by:
      computeAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      remappingFunction - - function to compute a value
      Returns:
      the new value associated with the specified key, or null if none
    • compute

      public V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
      Specified by:
      compute in interface ConcurrentMap<K,V>
      Specified by:
      compute in interface Map<K,V>
    • computeIfAbsentAsync

      public RFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction)
      Description copied from interface: RMapAsync
      Computes a mapping for the specified key if it's not mapped before.
      Specified by:
      computeIfAbsentAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      mappingFunction - - function to compute a value
      Returns:
      current or new computed value associated with the specified key, or null if the computed value is null
    • computeIfAbsent

      public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
      Specified by:
      computeIfAbsent in interface ConcurrentMap<K,V>
      Specified by:
      computeIfAbsent in interface Map<K,V>
    • computeIfPresentAsync

      public RFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
      Description copied from interface: RMapAsync
      Computes a mapping for the specified key only if it's already mapped.
      Specified by:
      computeIfPresentAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      remappingFunction - - function to compute a value
      Returns:
      the new value associated with the specified key, or null if none
    • computeIfPresent

      public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
      Specified by:
      computeIfPresent in interface ConcurrentMap<K,V>
      Specified by:
      computeIfPresent in interface Map<K,V>
    • sizeAsync

      public RFuture<Integer> sizeAsync()
      Description copied from interface: RMapAsync
      Returns size of this map
      Specified by:
      sizeAsync in interface RMapAsync<K,V>
      Returns:
      size
    • valueSize

      public int valueSize(K key)
      Description copied from interface: RMap
      Returns size of value mapped by specified key in bytes
      Specified by:
      valueSize in interface RMap<K,V>
      Parameters:
      key - - map key
      Returns:
      size of value
    • 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>
      Parameters:
      key - - map key
      Returns:
      size of value
    • checkKey

      protected void checkKey(Object key)
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Description copied from interface: RMap
      Returns true if this map contains map entry mapped by specified key, otherwise false
      Specified by:
      containsKey in interface Map<K,V>
      Specified by:
      containsKey in interface RMap<K,V>
      Parameters:
      key - - map key
      Returns:
      true if this map contains map entry mapped by specified key, otherwise false
    • 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>
      Parameters:
      key - - map key
      Returns:
      true if this map contains map entry mapped by specified key, otherwise false
    • containsKeyOperationAsync

      protected RFuture<Boolean> containsKeyOperationAsync(String name, Object key)
    • containsKeyAsync

      protected RFuture<Boolean> containsKeyAsync(Object key, CompletableFuture<V> promise)
    • containsValue

      public boolean containsValue(Object value)
      Description copied from interface: RMap
      Returns true if this map contains any map entry with specified value, otherwise false
      Specified by:
      containsValue in interface Map<K,V>
      Specified by:
      containsValue in interface RMap<K,V>
      Parameters:
      value - - map value
      Returns:
      true if this map contains any map entry with specified value, 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>
      Parameters:
      value - - map value
      Returns:
      true if this map contains any map entry with specified value, otherwise false
    • getAll

      public Map<K,V> getAll(Set<K> keys)
      Description copied from interface: RMap
      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:
      getAll in interface RMap<K,V>
      Parameters:
      keys - map keys
      Returns:
      Map slice
    • randomKeys

      public Set<K> randomKeys(int count)
      Description copied from interface: RMap
      Returns random keys from this map limited by count
      Specified by:
      randomKeys in interface RMap<K,V>
      Parameters:
      count - - keys amount to return
      Returns:
      random keys
    • randomEntries

      public Map<K,V> randomEntries(int count)
      Description copied from interface: RMap
      Returns random map entries from this map limited by count
      Specified by:
      randomEntries in interface RMap<K,V>
      Parameters:
      count - - entries amount to return
      Returns:
      random entries
    • randomKeysAsync

      public RFuture<Set<K>> randomKeysAsync(int count)
      Description copied from interface: RMapAsync
      Returns random keys from this map limited by count
      Specified by:
      randomKeysAsync in interface RMapAsync<K,V>
      Parameters:
      count - - keys amount to return
      Returns:
      random keys
    • randomEntriesAsync

      public RFuture<Map<K,V>> randomEntriesAsync(int count)
      Description copied from interface: RMapAsync
      Returns random map entries from this map limited by count
      Specified by:
      randomEntriesAsync in interface RMapAsync<K,V>
      Parameters:
      count - - entries amount to return
      Returns:
      random entries
    • 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>
      Parameters:
      keys - - map keys
      Returns:
      Map slice
    • hasNoLoader

      protected boolean hasNoLoader()
    • getAllOperationAsync

      public RFuture<Map<K,V>> getAllOperationAsync(Set<K> keys)
    • get

      public V get(Object key)
      Description copied from interface: RMap
      Returns the value mapped by defined key or null if value is absent.

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

      Specified by:
      get in interface Map<K,V>
      Specified by:
      get in interface RMap<K,V>
      Parameters:
      key - the key
      Returns:
      the value mapped by defined key or null if value is absent
    • put

      public V put(K key, V value)
      Description copied from interface: RMap
      Stores the specified value mapped by specified key. Returns previous value if map entry with specified key already existed.

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

      Specified by:
      put in interface Map<K,V>
      Specified by:
      put in interface RMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      previous associated value
    • remove

      public V remove(Object key)
      Description copied from interface: RMap
      Removes map entry by specified key and returns value.

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

      Specified by:
      remove in interface Map<K,V>
      Specified by:
      remove in interface RMap<K,V>
      Parameters:
      key - - map key
      Returns:
      deleted value, null if map entry doesn't exist
    • putAll

      public final void putAll(Map<? extends K,? extends V> map)
      Description copied from interface: RMap
      Stores map entries specified in map object in batch mode.

      If MapWriter is defined then map entries will be stored in write-through mode.

      Specified by:
      putAll in interface Map<K,V>
      Specified by:
      putAll in interface RMap<K,V>
      Parameters:
      map - mappings to be stored in this map
    • putAll

      public void putAll(Map<? extends K,? extends V> map, int batchSize)
      Description copied from interface: RMap
      Stores map entries specified in map object in batch mode. Batch inserted by chunks limited by batchSize value to avoid OOM and/or Redis response timeout error for map with big size.

      If MapWriter is defined then map entries are stored in write-through mode.

      Specified by:
      putAll in interface RMap<K,V>
      Parameters:
      map - mappings to be stored in this map
      batchSize - - size of map entries batch
    • putAllAsync

      public RFuture<Void> putAllAsync(Map<? extends K,? extends V> map, int batchSize)
      Description copied from interface: RMapAsync
      Stores map entries specified in map object in batch mode. Batch inserted by chunks limited by batchSize value to avoid OOM and/or Redis response timeout error for map with big size.

      If MapWriter is defined then map entries are stored in write-through mode.

      Specified by:
      putAllAsync in interface RMapAsync<K,V>
      Parameters:
      map - mappings to be stored in this map
      batchSize - - size of map entries batch
      Returns:
      void
    • putAllAsync

      public final RFuture<Void> putAllAsync(Map<? extends K,? extends V> map)
      Description copied from interface: RMapAsync
      Stores map entries specified in map object in batch mode.

      If MapWriter is defined then map entries will be stored in write-through mode.

      Specified by:
      putAllAsync in interface RMapAsync<K,V>
      Parameters:
      map - mappings to be stored in this map
      Returns:
      void
    • mapWriterFuture

      protected final <M> RFuture<M> mapWriterFuture(RFuture<M> future, MapWriterTask task)
    • mapWriterFuture

      protected final <M> RFuture<M> mapWriterFuture(RFuture<M> future, MapWriterTask task, Function<M,Boolean> condition)
    • putAllOperationAsync

      protected RFuture<Void> putAllOperationAsync(Map<? extends K,? extends V> map)
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • keySet

      public Set<K> keySet()
      Description copied from interface: RMap
      Returns key set of this map. Keys are loaded in batch. Batch size is 10.
      Specified by:
      keySet in interface Map<K,V>
      Specified by:
      keySet in interface RMap<K,V>
      Returns:
      key set
      See Also:
    • keySet

      public Set<K> keySet(String pattern)
      Description copied from interface: RMap
      Returns key set of this map. If pattern is not null then only keys match 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:
      keySet in interface RMap<K,V>
      Parameters:
      pattern - - key pattern
      Returns:
      key set
      See Also:
    • 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>
      Parameters:
      pattern - - key pattern
      count - - size of keys batch
      Returns:
      key set
      See Also:
    • keySet

      public Set<K> keySet(int count)
      Description copied from interface: RMap
      Returns key set of this map. Keys are loaded in batch. Batch size is defined by count param.
      Specified by:
      keySet in interface RMap<K,V>
      Parameters:
      count - - size of keys batch
      Returns:
      key set
      See Also:
    • values

      public Collection<V> values()
      Description copied from interface: RMap
      Returns values collection of this map. Values are loaded in batch. Batch size is 10.
      Specified by:
      values in interface Map<K,V>
      Specified by:
      values in interface RMap<K,V>
      Returns:
      values collection
      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>
      Parameters:
      keyPattern - - key pattern
      count - - size of values batch
      Returns:
      values collection
      See Also:
    • values

      public Collection<V> values(String keyPattern)
      Description copied from interface: RMap
      Returns values collection of this map. Values are loaded in batch. Batch size is 10. 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>
      Parameters:
      keyPattern - - key pattern
      Returns:
      values collection
      See Also:
    • values

      public Collection<V> values(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.
      Specified by:
      values in interface RMap<K,V>
      Parameters:
      count - - size of values batch
      Returns:
      values collection
      See Also:
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Description copied from interface: RMap
      Returns map entries collection. Map entries are loaded in batch. Batch size is 10.
      Specified by:
      entrySet in interface Map<K,V>
      Specified by:
      entrySet in interface RMap<K,V>
      Returns:
      map entries collection
      See Also:
    • entrySet

      public Set<Map.Entry<K,V>> entrySet(String keyPattern)
      Description copied from interface: RMap
      Returns map entries collection. Map entries are loaded in batch. Batch size is 10. 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>
      Parameters:
      keyPattern - - key pattern
      Returns:
      map entries 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>
      Parameters:
      keyPattern - - key pattern
      count - - size of entries batch
      Returns:
      map entries collection
      See Also:
    • entrySet

      public Set<Map.Entry<K,V>> entrySet(int count)
      Description copied from interface: RMap
      Returns map entries collection. Map entries are loaded in batch. Batch size is defined by count param.
      Specified by:
      entrySet in interface RMap<K,V>
      Parameters:
      count - - size of entries batch
      Returns:
      map entries collection
      See Also:
    • readAllKeySet

      public Set<K> readAllKeySet()
      Description copied from interface: RMap
      Read all keys at once
      Specified by:
      readAllKeySet in interface RMap<K,V>
      Returns:
      keys
    • readAllKeySetAsync

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

      public Collection<V> readAllValues()
      Description copied from interface: RMap
      Read all values at once
      Specified by:
      readAllValues in interface RMap<K,V>
      Returns:
      values
    • readAllValuesAsync

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

      public Set<Map.Entry<K,V>> readAllEntrySet()
      Description copied from interface: RMap
      Read all map entries at once
      Specified by:
      readAllEntrySet in interface RMap<K,V>
      Returns:
      entries
    • 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>
      Returns:
      entries
    • readAllMap

      public Map<K,V> readAllMap()
      Description copied from interface: RMap
      Read all map as local instance at once
      Specified by:
      readAllMap in interface RMap<K,V>
      Returns:
      map
    • 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>
      Returns:
      map
    • putIfExists

      public V putIfExists(K key, V value)
      Description copied from interface: RMap
      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:
      putIfExists in interface RMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      null if key doesn't exist in the hash and value hasn't been set. Previous value if key already exists in the hash and new value has been stored.
    • 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>
      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.
    • putIfExistsOperationAsync

      protected RFuture<V> putIfExistsOperationAsync(K key, V value)
    • putIfAbsent

      public V putIfAbsent(K key, V value)
      Description copied from interface: RMap
      Stores the specified value mapped by 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:
      putIfAbsent in interface ConcurrentMap<K,V>
      Specified by:
      putIfAbsent in interface Map<K,V>
      Specified by:
      putIfAbsent in interface RMap<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.
    • 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>
      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.
    • hasNoWriter

      protected boolean hasNoWriter()
    • putIfAbsentOperationAsync

      protected RFuture<V> putIfAbsentOperationAsync(K key, V value)
    • fastPutIfAbsent

      public boolean fastPutIfAbsent(K key, V value)
      Description copied from interface: RMap
      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 RMap.putIfAbsent(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:
      fastPutIfAbsent in interface RMap<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.
    • 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>
      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.
    • fastPutIfAbsentOperationAsync

      protected RFuture<Boolean> fastPutIfAbsentOperationAsync(K key, V value)
    • fastPutIfExists

      public boolean fastPutIfExists(K key, V value)
      Description copied from interface: RMap
      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 RMap.putIfExists(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:
      fastPutIfExists in interface RMap<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.
    • 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>
      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.
    • fastPutIfExistsOperationAsync

      protected RFuture<Boolean> fastPutIfExistsOperationAsync(K key, V value)
    • remove

      public boolean remove(Object key, Object value)
      Description copied from interface: RMap
      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:
      remove in interface ConcurrentMap<K,V>
      Specified by:
      remove in interface Map<K,V>
      Specified by:
      remove in interface RMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if map entry has been removed otherwise false.
    • 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>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if map entry has been removed otherwise false.
    • removeOperationAsync

      protected RFuture<Boolean> removeOperationAsync(Object key, Object value)
    • checkValue

      protected void checkValue(Object value)
    • encodeMapKeys

      protected void encodeMapKeys(Collection<Object> params, Map<?,?> map)
    • replace

      public boolean replace(K key, V oldValue, V newValue)
      Description copied from interface: RMap
      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:
      replace in interface ConcurrentMap<K,V>
      Specified by:
      replace in interface Map<K,V>
      Specified by:
      replace in interface RMap<K,V>
      Parameters:
      key - - map key
      oldValue - - map old value
      newValue - - map new value
      Returns:
      true if value has been replaced otherwise false.
    • 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>
      Parameters:
      key - - map key
      oldValue - - map old value
      newValue - - map new value
      Returns:
      true if value has been replaced otherwise false.
    • replaceOperationAsync

      protected RFuture<Boolean> replaceOperationAsync(K key, V oldValue, V newValue)
    • replace

      public V replace(K key, V value)
      Description copied from interface: RMap
      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:
      replace in interface ConcurrentMap<K,V>
      Specified by:
      replace in interface Map<K,V>
      Specified by:
      replace in interface RMap<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
    • 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>
      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<V> replaceOperationAsync(K key, V value)
    • fastReplace

      public boolean fastReplace(K key, V value)
      Description copied from interface: RMap
      Replaces previous value with a new value mapped by specified key.

      Works faster than RMap.replace(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:
      fastReplace in interface RMap<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.
    • 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>
      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)
    • getOperationAsync

      public RFuture<V> getOperationAsync(K key)
    • getAsync

      public final RFuture<V> getAsync(K key)
      Description copied from interface: RMapAsync
      Returns the value mapped by defined key or null if value is absent.

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

      Specified by:
      getAsync in interface RMapAsync<K,V>
      Parameters:
      key - the key
      Returns:
      the value mapped by defined key or null if value is absent
    • getAsync

      protected RFuture<V> getAsync(K key, long threadId)
    • loadAll

      public void loadAll(boolean replaceExistingValues, int parallelism)
      Description copied from interface: RMap
      Loads all map entries to this Redis map using MapLoader.
      Specified by:
      loadAll in interface RMap<K,V>
      Parameters:
      replaceExistingValues - - true if existed values should be replaced, false otherwise.
      parallelism - - parallelism level, used to increase speed of process execution
    • 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>
      Parameters:
      replaceExistingValues - - true if existed values should be replaced, false otherwise.
      parallelism - - parallelism level, used to increase speed of process execution
      Returns:
      void
    • loadAllMapAsync

      protected CompletionStage<Map<K,V>> loadAllMapAsync(Spliterator<K> spliterator, boolean replaceExistingValues, int parallelism)
    • loadAll

      public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
      Description copied from interface: RMap
      Loads map entries using MapLoader whose keys are listed in defined keys parameter.
      Specified by:
      loadAll in interface RMap<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
    • 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>
      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
    • putAsync

      public RFuture<V> putAsync(K key, V value)
      Description copied from interface: RMapAsync
      Stores the specified value mapped by specified key. Returns previous value if map entry with specified key already existed.

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

      Specified by:
      putAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      previous associated value
    • putOperationAsync

      protected RFuture<V> putOperationAsync(K key, V value)
    • removeAsync

      public RFuture<V> removeAsync(K key)
      Description copied from interface: RMapAsync
      Removes map entry by specified key and returns value.

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

      Specified by:
      removeAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      Returns:
      deleted value, null if map entry doesn't exist
    • removeOperationAsync

      protected RFuture<V> removeOperationAsync(K key)
    • fastPutAsync

      public RFuture<Boolean> fastPutAsync(K key, V value)
      Description copied from interface: RMapAsync
      Stores the specified value mapped by specified key.

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

      Returns true if key is a new key in the hash and value was set or false if key already exists in the hash and the value was updated.

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

      Specified by:
      fastPutAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
    • fastPutOperationAsync

      protected RFuture<Boolean> fastPutOperationAsync(K key, V value)
    • fastPut

      public boolean fastPut(K key, V value)
      Description copied from interface: RMap
      Stores the specified value mapped by specified key.

      Works faster than RMap.put(Object, Object) but not returning previous value.

      Returns true if key is a new key in the hash and value was set or false if key already exists in the hash and the value was updated.

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

      Specified by:
      fastPut in interface RMap<K,V>
      Parameters:
      key - - map key
      value - - map value
      Returns:
      true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
    • fastRemoveAsync

      public RFuture<Long> fastRemoveAsync(K... keys)
      Description copied from interface: RMapAsync
      Removes map entries mapped by specified keys.

      Works faster than RMapAsync.removeAsync(Object) but not returning the value.

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

      Specified by:
      fastRemoveAsync in interface RMapAsync<K,V>
      Parameters:
      keys - - map keys
      Returns:
      the number of keys that were removed from the hash, not including specified but non existing keys
    • fastRemoveOperationBatchAsync

      protected RFuture<List<Long>> fastRemoveOperationBatchAsync(K... keys)
    • fastRemoveOperationAsync

      protected RFuture<Long> fastRemoveOperationAsync(K... keys)
    • fastRemove

      public long fastRemove(K... keys)
      Description copied from interface: RMap
      Removes map entries mapped by specified keys.

      Works faster than RMap.remove(Object) but not returning the value.

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

      Specified by:
      fastRemove in interface RMap<K,V>
      Parameters:
      keys - - map keys
      Returns:
      the number of keys that were removed from the hash, not including specified but non existing keys
    • scanIterator

      public ScanResult<Map.Entry<Object,Object>> scanIterator(String name, RedisClient client, String startPos, String pattern, int count)
    • scanKeyIterator

      public ScanResult<Object> scanKeyIterator(String name, RedisClient client, String startPos, String pattern, int count)
    • scanKeyIteratorAsync

      public RFuture<ScanResult<Object>> scanKeyIteratorAsync(String name, RedisClient client, String startPos, String pattern, int count)
    • scanIteratorAsync

      public RFuture<ScanResult<Map.Entry<Object,Object>>> scanIteratorAsync(String name, RedisClient client, String startPos, String pattern, int count)
    • addAndGet

      public V addAndGet(K key, Number value)
      Description copied from interface: RMap
      Adds the given delta to the current value by mapped key.

      Works only with codecs below

      JsonJacksonCodec,

      StringCodec,

      IntegerCodec,

      DoubleCodec

      LongCodec

      Specified by:
      addAndGet in interface RMap<K,V>
      Parameters:
      key - - map key
      value - the value to add
      Returns:
      the updated value
    • addAndGetAsync

      public RFuture<V> addAndGetAsync(K key, Number value)
      Description copied from interface: RMapAsync
      Adds the given delta to the current value by mapped key.

      Works only with codecs below

      JsonJacksonCodec,

      StringCodec,

      IntegerCodec,

      DoubleCodec

      LongCodec

      Specified by:
      addAndGetAsync in interface RMapAsync<K,V>
      Parameters:
      key - - map key
      value - the value to add
      Returns:
      the updated value
    • addAndGetOperationAsync

      protected RFuture<V> addAndGetOperationAsync(K key, Number value)
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<K,V>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class Object
    • keyIterator

      protected Iterator<K> keyIterator(String pattern, int count)
    • valueIterator

      protected Iterator<V> valueIterator(String pattern, int count)
    • entryIterator

      protected Iterator<Map.Entry<K,V>> entryIterator(String pattern, int count)
    • loadValue

      protected CompletableFuture<V> loadValue(K key, boolean replaceValue)
    • loadValue

      protected CompletableFuture<V> loadValue(K key, boolean replaceValue, long threadId)
    • clearAsync

      public RFuture<Boolean> clearAsync()
      Description copied from interface: RMapAsync
      Clears map without removing options data used during map creation.
      Specified by:
      clearAsync in interface RMapAsync<K,V>
      Returns:
      true if map was cleared false if not
    • destroy

      public void destroy()
      Description copied from interface: RDestroyable
      Destroys object when it's not necessary anymore.
      Specified by:
      destroy in interface RDestroyable
    • addListener

      public int addListener(ObjectListener listener)
      Description copied from interface: RObject
      Adds object event listener
      Specified by:
      addListener in interface RMap<K,V>
      Specified by:
      addListener in interface RObject
      Overrides:
      addListener in class RedissonObject
      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 RedissonObject
      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)