Package org.redisson

Class MapCacheNativeWrapper<K,V>

java.lang.Object
org.redisson.MapCacheNativeWrapper<K,V>
All Implemented Interfaces:
ConcurrentMap<K,V>, Supplier<RMap<K,V>>, Map<K,V>, RDestroyable, RExpirable, RExpirableAsync, RMap<K,V>, RMapAsync<K,V>, RMapCache<K,V>, RMapCacheAsync<K,V>, RObject, RObjectAsync

public class MapCacheNativeWrapper<K,V> extends Object implements RMapCache<K,V>, Supplier<RMap<K,V>>
  • Constructor Details

  • Method Details

    • get

      public RMap<K,V> get()
      Specified by:
      get in interface Supplier<K>
    • setMaxSize

      public void setMaxSize(int maxSize)
      Description copied from interface: RMapCache
      Sets max size of the map and overrides current value. Superfluous elements are evicted using LRU algorithm.
      Specified by:
      setMaxSize in interface RMapCache<K,V>
      Parameters:
      maxSize - - max size If 0 the cache is unbounded (default).
    • setMaxSize

      public void setMaxSize(int maxSize, EvictionMode mode)
      Description copied from interface: RMapCache
      Sets max size of the map and overrides current value. Superfluous elements are evicted using defined algorithm.
      Specified by:
      setMaxSize in interface RMapCache<K,V>
      Parameters:
      maxSize - - max size
      mode - - eviction mode
    • trySetMaxSize

      public boolean trySetMaxSize(int maxSize)
      Description copied from interface: RMapCache
      Tries to set max size of the map. Superfluous elements are evicted using LRU algorithm.
      Specified by:
      trySetMaxSize in interface RMapCache<K,V>
      Parameters:
      maxSize - - max size
      Returns:
      true if max size has been successfully set, otherwise false. If 0 the cache is unbounded (default).
    • trySetMaxSize

      public boolean trySetMaxSize(int maxSize, EvictionMode mode)
      Description copied from interface: RMapCache
      Tries to set max size of the map. Superfluous elements are evicted using defined algorithm.
      Specified by:
      trySetMaxSize in interface RMapCache<K,V>
      Parameters:
      maxSize - - max size
      mode - - eviction mode
      Returns:
      true if max size has been successfully set, otherwise false.
    • computeIfAbsent

      public V computeIfAbsent(K key, Duration ttl, Function<? super K,? extends V> mappingFunction)
      Description copied from interface: RMapCache
      If the specified key is not already associated with a value, attempts to compute its value using the given mapping function and enters it into this map .

      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

      Specified by:
      computeIfAbsent in interface RMapCache<K,V>
      Parameters:
      key - - map key
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      mappingFunction - the mapping function to compute a value
      Returns:
      current associated value
    • compute

      public V compute(K key, Duration ttl, BiFunction<? super K,? super V,? extends V> remappingFunction)
      Description copied from interface: RMapCache
      Computes a new mapping for the specified key and its current mapped value.

      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

      Specified by:
      compute in interface RMapCache<K,V>
      Parameters:
      key - - map key
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      remappingFunction - - function to compute a value
      Returns:
      the new value associated with the specified key, or null if none
    • getWithTTLOnly

      public V getWithTTLOnly(K key)
      Description copied from interface: RMapCache
      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.

      NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.

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

      public Map<K,V> getAllWithTTLOnly(Set<K> keys)
      Description copied from interface: RMapCache
      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.

      NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.

      Specified by:
      getAllWithTTLOnly in interface RMapCache<K,V>
      Parameters:
      keys - map keys
      Returns:
      Map slice
    • fastPut

      public boolean fastPut(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCache
      Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

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

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

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

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

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

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

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

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

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

      Returns:
      current associated value
    • 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
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • 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
    • destroy

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

      public V put(K key, V value, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCache
      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

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

      Specified by:
      put in interface RMapCache<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      ttlUnit - - time unit
      Returns:
      previous associated value
    • put

      public V put(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCache
      Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

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

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

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

      Returns:
      previous associated value
    • fastPut

      public boolean fastPut(K key, V value, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCache
      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

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

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

      Specified by:
      fastPut in interface RMapCache<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      ttlUnit - - time unit
      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.
    • putIfAbsent

      public V putIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCache
      If the specified key is not already associated with a value, associate it with the given value.

      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

      Specified by:
      putIfAbsent in interface RMapCache<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      ttlUnit - - time unit
      Returns:
      current associated value
    • fastPutIfAbsent

      public boolean fastPutIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCache
      If the specified key is not already associated with a value, associate it with the given value.

      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

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

      Specified by:
      fastPutIfAbsent in interface RMapCache<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      ttlUnit - - time unit
      Returns:
      true if key is a new key in the hash and value was set. false if key already exists in the hash
    • fastPutIfAbsent

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

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

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

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

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

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

      public void putAll(Map<? extends K,? extends V> map, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCache
      Associates the specified value with the specified key in batch.

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

      Specified by:
      putAll in interface RMapCache<K,V>
      Parameters:
      map - - mappings to be stored in this map
      ttl - - time to live for all key\value entries. If 0 then stores infinitely.
      ttlUnit - - time unit
    • updateEntryExpiration

      public boolean updateEntryExpiration(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCache
      Specified by:
      updateEntryExpiration in interface RMapCache<K,V>
      Parameters:
      key - - map key
      ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
      ttlUnit - - time unit
      maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
      maxIdleUnit - - time unit

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

      Returns:
      returns false if entry already expired or doesn't exist, otherwise returns true.
    • expireEntry

      public boolean expireEntry(K key, Duration ttl, Duration maxIdleTime)
      Description copied from interface: RMapCache
      Updates time to live and max idle time of specified entry by key. Entry expires when specified time to live or max idle time was reached.

      Returns false if entry already expired or doesn't exist, otherwise returns true.

      Specified by:
      expireEntry in interface RMapCache<K,V>
      Parameters:
      key - map key
      ttl - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
      maxIdleTime - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.

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

      Returns:
      returns false if entry already expired or doesn't exist, otherwise returns true.
    • expireEntries

      public int expireEntries(Set<K> keys, Duration ttl, Duration maxIdleTime)
      Description copied from interface: RMapCache
      Updates time to live and max idle time of specified entries by keys. Entries expires when specified time to live or max idle time was reached.

      Returns amount of updated entries.

      Specified by:
      expireEntries in interface RMapCache<K,V>
      Parameters:
      keys - map keys
      ttl - time to live for key\value entries. If 0 then time to live doesn't affect entry expiration.
      maxIdleTime - max idle time for key\value entries. If 0 then max idle time doesn't affect entry expiration.

      if maxIdleTime and ttl params are equal to 0 then entries are stored infinitely.

      Returns:
      amount of updated entries.
    • expireEntryIfNotSet

      public boolean expireEntryIfNotSet(K key, Duration ttl, Duration maxIdleTime)
      Description copied from interface: RMapCache
      Sets time to live and max idle time of specified entry by key. If these parameters weren't set before. Entry expires when specified time to live or max idle time was reached.

      Returns false if entry already has expiration time or doesn't exist, otherwise returns true.

      Specified by:
      expireEntryIfNotSet in interface RMapCache<K,V>
      Parameters:
      key - map key
      ttl - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
      maxIdleTime - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.

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

      Returns:
      returns false if entry already has expiration time or doesn't exist, otherwise returns true.
    • expireEntriesIfNotSet

      public int expireEntriesIfNotSet(Set<K> keys, Duration ttl, Duration maxIdleTime)
      Description copied from interface: RMapCache
      Sets time to live and max idle time of specified entries by keys. If these parameters weren't set before. Entries expire when specified time to live or max idle time was reached.

      Returns amount of updated entries.

      Specified by:
      expireEntriesIfNotSet in interface RMapCache<K,V>
      Parameters:
      keys - map keys
      ttl - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
      maxIdleTime - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.

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

      Returns:
      amount of updated entries.
    • addListener

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

      public RFuture<V> putAsync(K key, V value, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCacheAsync
      Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
      Specified by:
      putAsync in interface RMapCacheAsync<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      ttlUnit - - time unit
      Returns:
      previous associated value
    • putAsync

      public RFuture<V> putAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCacheAsync
      Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

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

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

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

      Returns:
      previous associated value
    • fastPutAsync

      public RFuture<Boolean> fastPutAsync(K key, V value, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCacheAsync
      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

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

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

      Specified by:
      fastPutAsync in interface RMapCacheAsync<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      ttlUnit - - time unit
      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.
    • fastPutAsync

      public RFuture<Boolean> fastPutAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCacheAsync
      Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

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

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

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

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

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

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

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

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

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

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

      Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.

      Specified by:
      putIfAbsentAsync in interface RMapCacheAsync<K,V>
      Parameters:
      key - - map key
      value - - map value
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      ttlUnit - - time unit
      Returns:
      previous associated value
    • putIfAbsentAsync

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

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

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

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

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

      Returns:
      previous associated value
    • fastPutIfAbsentAsync

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

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

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

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

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

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

      public RFuture<V> computeIfAbsentAsync(K key, Duration ttl, Function<? super K,? extends V> mappingFunction)
      Description copied from interface: RMapCacheAsync
      If the specified key is not already associated with a value, attempts to compute its value using the given mapping function and enters it into this map .

      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

      Specified by:
      computeIfAbsentAsync in interface RMapCacheAsync<K,V>
      Parameters:
      key - - map key
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      mappingFunction - the mapping function to compute a value
      Returns:
      current associated value
    • computeAsync

      public RFuture<V> computeAsync(K key, Duration ttl, BiFunction<? super K,? super V,? extends V> remappingFunction)
      Description copied from interface: RMapCacheAsync
      Computes a new mapping for the specified key and its current mapped value.

      Stores value mapped by key with specified time to live. Entry expires after specified time to live.

      Specified by:
      computeAsync in interface RMapCacheAsync<K,V>
      Parameters:
      key - - map key
      ttl - - time to live for key\value entry. If 0 then stores infinitely.
      remappingFunction - - function to compute a value
      Returns:
      the new value associated with the specified key, or null if none
    • updateEntryExpirationAsync

      public RFuture<Boolean> updateEntryExpirationAsync(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
      Description copied from interface: RMapCacheAsync
      Specified by:
      updateEntryExpirationAsync in interface RMapCacheAsync<K,V>
      Parameters:
      key - - map key
      ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
      ttlUnit - - time unit
      maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
      maxIdleUnit - - time unit

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

      Returns:
      returns false if entry already expired or doesn't exist, otherwise returns true.
    • expireEntryAsync

      public RFuture<Boolean> expireEntryAsync(K key, Duration ttl, Duration maxIdleTime)
      Description copied from interface: RMapCacheAsync
      Updates time to live and max idle time of specified entry by key. Entry expires when specified time to live or max idle time was reached.

      Returns false if entry already expired or doesn't exist, otherwise returns true.

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

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

      Returns:
      returns false if entry already expired or doesn't exist, otherwise returns true.
    • expireEntriesAsync

      public RFuture<Integer> expireEntriesAsync(Set<K> keys, Duration ttl, Duration maxIdleTime)
      Description copied from interface: RMapCacheAsync
      Updates time to live and max idle time of specified entries by keys. Entries expires when specified time to live or max idle time was reached.

      Returns amount of updated entries.

      Specified by:
      expireEntriesAsync in interface RMapCacheAsync<K,V>
      Parameters:
      keys - map keys
      ttl - time to live for key\value entries. If 0 then time to live doesn't affect entry expiration.
      maxIdleTime - max idle time for key\value entries. If 0 then max idle time doesn't affect entry expiration.

      if maxIdleTime and ttl params are equal to 0 then entries are stored infinitely.

      Returns:
      amount of updated entries.
    • getWithTTLOnlyAsync

      public RFuture<V> getWithTTLOnlyAsync(K key)
      Description copied from interface: RMapCacheAsync
      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.

      NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.

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

      public RFuture<Map<K,V>> getAllWithTTLOnlyAsync(Set<K> keys)
      Description copied from interface: RMapCacheAsync
      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.

      NOTE: Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.

      Specified by:
      getAllWithTTLOnlyAsync in interface RMapCacheAsync<K,V>
      Parameters:
      keys - map keys
      Returns:
      Map slice
    • putAllAsync

      public RFuture<Void> putAllAsync(Map<? extends K,? extends V> map, long ttl, TimeUnit ttlUnit)
      Description copied from interface: RMapCacheAsync
      Associates the specified value with the specified key in batch.

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

      Specified by:
      putAllAsync in interface RMapCacheAsync<K,V>
      Parameters:
      map - - mappings to be stored in this map
      ttl - - time to live for all key\value entries. If 0 then stores infinitely.
      ttlUnit - - time unit
      Returns:
      void
    • 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
    • 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
    • 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 void putAll(Map<? extends K,? extends V> m)
      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:
      m - 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
    • 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(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:
    • 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(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:
    • 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)
      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.

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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(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.

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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(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.

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

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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.

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

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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:
    • 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.
    • 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.
    • 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.
    • 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.
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • addAndGet

      public V addAndGet(K key, Number delta)
      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
      delta - the value to add
      Returns:
      the updated 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.
    • 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.
    • 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
    • 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
    • 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
    • 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
    • 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.
    • 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.
    • 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
    • getAsync

      public RFuture<V> getAsync(Object 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
    • 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
    • removeAsync

      public RFuture<V> removeAsync(Object 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
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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
    • 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
    • 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
    • readAllKeySetAsync

      public RFuture<Set<K>> readAllKeySetAsync(String keyPattern)
      Description copied from interface: RMapAsync
      Read all keys mapped by matched keys of this pattern at once
      Specified by:
      readAllKeySetAsync in interface RMapAsync<K,V>
      Parameters:
      keyPattern - - key Pattern
      Returns:
      keys
    • readAllValuesAsync

      public RFuture<Collection<V>> readAllValuesAsync(String keyPattern)
      Description copied from interface: RMapAsync
      Read all values mapped by matched keys of this pattern at once
      Specified by:
      readAllValuesAsync in interface RMapAsync<K,V>
      Parameters:
      keyPattern - - key Pattern
      Returns:
      values
    • readAllEntrySetAsync

      public RFuture<Set<Map.Entry<K,V>>> readAllEntrySetAsync(String keyPattern)
      Description copied from interface: RMapAsync
      Read all entries mapped by matched keys of this pattern at once
      Specified by:
      readAllEntrySetAsync in interface RMapAsync<K,V>
      Parameters:
      keyPattern - - key Pattern
      Returns:
      entries
    • 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
    • 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.
    • 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.
    • 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
    • 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
    • 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
    • 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
    • expire

      public boolean expire(Instant time)
      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:
      time - 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • clearExpire

      public boolean clearExpire()
      Description copied from interface: RExpirable
      Clear an expire timeout or expire date for object.
      Specified by:
      clearExpire in interface RExpirable
      Returns:
      true if timeout was removed false if object does not exist or does not have an associated timeout
    • remainTimeToLive

      public long remainTimeToLive()
      Description copied from interface: RExpirable
      Returns remaining time of the object in milliseconds.
      Specified by:
      remainTimeToLive in interface RExpirable
      Returns:
      time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
    • getExpireTime

      public long getExpireTime()
      Description copied from interface: RExpirable
      Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTime in interface RExpirable
      Returns:
      Unix time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expiration time.
    • 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
    • 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
    • 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
    • expireAsync

      public RFuture<Boolean> expireAsync(Instant time)
      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:
      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
    • 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
    • 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
    • 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(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
    • 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
    • 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
    • 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
    • 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
    • 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
    • remainTimeToLiveAsync

      public RFuture<Long> remainTimeToLiveAsync()
      Description copied from interface: RExpirableAsync
      Returns remaining time of the object in milliseconds.
      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.
    • getExpireTimeAsync

      public RFuture<Long> getExpireTimeAsync()
      Description copied from interface: RExpirableAsync
      Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTimeAsync in interface RExpirableAsync
      Returns:
      Unix time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expiration time.
    • getName

      public String getName()
      Description copied from interface: RObject
      Returns name of object
      Specified by:
      getName in interface RObject
      Returns:
      name - name of object
    • rename

      public void rename(String newName)
      Description copied from interface: RObject
      Rename current object key to newName
      Specified by:
      rename in interface RObject
      Parameters:
      newName - - new name of object
    • renamenx

      public boolean renamenx(String newName)
      Description copied from interface: RObject
      Rename current object key to newName only if new key doesn't exist.
      Specified by:
      renamenx in interface RObject
      Parameters:
      newName - - new name of object
      Returns:
      true if object has been renamed successfully and false otherwise
    • isExists

      public boolean isExists()
      Description copied from interface: RObject
      Check object existence
      Specified by:
      isExists in interface RObject
      Returns:
      true if object exists and false otherwise
    • getCodec

      public Codec getCodec()
      Description copied from interface: RObject
      Returns the underlying Codec used by this RObject
      Specified by:
      getCodec in interface RObject
      Returns:
      Codec of object
    • getIdleTime

      public Long getIdleTime()
      Description copied from interface: RObject
      Returns number of seconds spent since last write or read operation over this object.
      Specified by:
      getIdleTime in interface RObject
      Returns:
      number of seconds
    • getReferenceCount

      public int getReferenceCount()
      Description copied from interface: RObject
      Returns count of references over this object.
      Specified by:
      getReferenceCount in interface RObject
      Returns:
      count of reference
    • getAccessFrequency

      public int getAccessFrequency()
      Description copied from interface: RObject
      Returns the logarithmic access frequency counter over this object.
      Specified by:
      getAccessFrequency in interface RObject
      Returns:
      frequency counter
    • getInternalEncoding

      public ObjectEncoding getInternalEncoding()
      Description copied from interface: RObject
      Returns the internal encoding for the Redis object
      Specified by:
      getInternalEncoding in interface RObject
      Returns:
      internal encoding
    • sizeInMemory

      public long sizeInMemory()
      Description copied from interface: RObject
      Returns bytes amount used by object in Redis memory.
      Specified by:
      sizeInMemory in interface RObject
      Returns:
      size in bytes
    • restore

      public void restore(byte[] state)
      Description copied from interface: RObject
      Restores object using its state returned by RObject.dump() method.
      Specified by:
      restore in interface RObject
      Parameters:
      state - - state of object
    • restore

      public void restore(byte[] state, long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RObject
      Restores object using its state returned by RObject.dump() method and set time to live for it.
      Specified by:
      restore in interface RObject
      Parameters:
      state - - state of object
      timeToLive - - time to live of the object
      timeUnit - - time unit
    • restoreAndReplace

      public void restoreAndReplace(byte[] state)
      Description copied from interface: RObject
      Restores and replaces object if it already exists.
      Specified by:
      restoreAndReplace in interface RObject
      Parameters:
      state - - state of the object
    • restoreAndReplace

      public void restoreAndReplace(byte[] state, long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RObject
      Restores and replaces object if it already exists and set time to live for it.
      Specified by:
      restoreAndReplace in interface RObject
      Parameters:
      state - - state of the object
      timeToLive - - time to live of the object
      timeUnit - - time unit
    • dump

      public byte[] dump()
      Description copied from interface: RObject
      Returns dump of object
      Specified by:
      dump in interface RObject
      Returns:
      dump
    • touch

      public boolean touch()
      Description copied from interface: RObject
      Update the last access time of an object.
      Specified by:
      touch in interface RObject
      Returns:
      true if object was touched else false
    • migrate

      public void migrate(String host, int port, int database, long timeout)
      Description copied from interface: RObject
      Copy object from source Redis instance to destination Redis instance
      Specified by:
      migrate in interface RObject
      Parameters:
      host - - destination host
      port - - destination port
      database - - destination database
      timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
    • copy

      public void copy(String host, int port, int database, long timeout)
      Description copied from interface: RObject
      Copy object from source Redis instance to destination Redis instance
      Specified by:
      copy in interface RObject
      Parameters:
      host - - destination host
      port - - destination port
      database - - destination database
      timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
    • copy

      public boolean copy(String destination)
      Description copied from interface: RObject
      Copy this object instance to the new instance with a defined name.
      Specified by:
      copy in interface RObject
      Parameters:
      destination - name of the destination instance
      Returns:
      true if this object instance was copied else false
    • copy

      public boolean copy(String destination, int database)
      Description copied from interface: RObject
      Copy this object instance to the new instance with a defined name and database.
      Specified by:
      copy in interface RObject
      Parameters:
      destination - name of the destination instance
      database - database number
      Returns:
      true if this object instance was copied else false
    • copyAndReplace

      public boolean copyAndReplace(String destination)
      Description copied from interface: RObject
      Copy this object instance to the new instance with a defined name, and replace it if it already exists.
      Specified by:
      copyAndReplace in interface RObject
      Parameters:
      destination - name of the destination instance
      Returns:
      true if this object instance was copied else false
    • copyAndReplace

      public boolean copyAndReplace(String destination, int database)
      Description copied from interface: RObject
      Copy this object instance to the new instance with a defined name and database, and replace it if it already exists.
      Specified by:
      copyAndReplace in interface RObject
      Parameters:
      destination - name of the destination instance
      database - database number
      Returns:
      true if this object instance was copied else false
    • move

      public boolean move(int database)
      Description copied from interface: RObject
      Move object to another database
      Specified by:
      move in interface RObject
      Parameters:
      database - - Redis database number
      Returns:
      true if key was moved else false
    • delete

      public boolean delete()
      Description copied from interface: RObject
      Deletes the object
      Specified by:
      delete in interface RObject
      Returns:
      true if it was exist and deleted else false
    • unlink

      public boolean unlink()
      Description copied from interface: RObject
      Delete the objects. Actual removal will happen later asynchronously.

      Requires Redis 4.0+

      Specified by:
      unlink in interface RObject
      Returns:
      true if it was exist and deleted else false
    • size

      public int size()
      Description copied from interface: RMapCache
      Returns the number of entries in cache. This number can reflects expired entries too due to non realtime cleanup process.
      Specified by:
      size in interface Map<K,V>
      Specified by:
      size in interface RMapCache<K,V>
    • addListener

      public int addListener(MapEntryListener listener)
      Description copied from interface: RMapCache
      Adds map entry listener
      Specified by:
      addListener in interface RMapCache<K,V>
      Parameters:
      listener - - entry listener
      Returns:
      listener id
      See Also:
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • 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
    • 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
    • renameAsync

      public RFuture<Void> renameAsync(String newName)
      Description copied from interface: RObjectAsync
      Rename current object key to newName in async mode
      Specified by:
      renameAsync in interface RObjectAsync
      Parameters:
      newName - - new name of object
      Returns:
      void
    • renamenxAsync

      public RFuture<Boolean> renamenxAsync(String newName)
      Description copied from interface: RObjectAsync
      Rename current object key to newName in async mode only if new key is not exists
      Specified by:
      renamenxAsync in interface RObjectAsync
      Parameters:
      newName - - new name of object
      Returns:
      true if object has been renamed successfully and false otherwise
    • isExistsAsync

      public RFuture<Boolean> isExistsAsync()
      Description copied from interface: RObjectAsync
      Check object existence in async mode.
      Specified by:
      isExistsAsync in interface RObjectAsync
      Returns:
      true if object exists and false otherwise
    • 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
      Parameters:
      listener - - object event listener
      Returns:
      listener id
      See Also:
    • removeListenerAsync

      public RFuture<Void> removeListenerAsync(int listenerId)
      Description copied from interface: RObjectAsync
      Removes object event listener
      Specified by:
      removeListenerAsync in interface RObjectAsync
      Parameters:
      listenerId - - listener id
    • getIdleTimeAsync

      public RFuture<Long> getIdleTimeAsync()
      Description copied from interface: RObjectAsync
      Returns number of seconds spent since last write or read operation over this object.
      Specified by:
      getIdleTimeAsync in interface RObjectAsync
      Returns:
      number of seconds
    • getReferenceCountAsync

      public RFuture<Integer> getReferenceCountAsync()
      Description copied from interface: RObjectAsync
      Returns count of references over this object.
      Specified by:
      getReferenceCountAsync in interface RObjectAsync
      Returns:
      count of reference
    • getAccessFrequencyAsync

      public RFuture<Integer> getAccessFrequencyAsync()
      Description copied from interface: RObjectAsync
      Returns the logarithmic access frequency counter over this object.
      Specified by:
      getAccessFrequencyAsync in interface RObjectAsync
      Returns:
      frequency counter
    • getInternalEncodingAsync

      public RFuture<ObjectEncoding> getInternalEncodingAsync()
      Description copied from interface: RObjectAsync
      Returns the internal encoding for the Redis object
      Specified by:
      getInternalEncodingAsync in interface RObjectAsync
      Returns:
      internal encoding
    • 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
      Returns:
      size in bytes
    • restoreAsync

      public RFuture<Void> restoreAsync(byte[] state)
      Description copied from interface: RObjectAsync
      Restores object using its state returned by RObjectAsync.dumpAsync() method.
      Specified by:
      restoreAsync in interface RObjectAsync
      Parameters:
      state - - state of object
      Returns:
      void
    • restoreAsync

      public RFuture<Void> restoreAsync(byte[] state, long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RObjectAsync
      Restores object using its state returned by RObjectAsync.dumpAsync() method and set time to live for it.
      Specified by:
      restoreAsync in interface RObjectAsync
      Parameters:
      state - - state of object
      timeToLive - - time to live of the object
      timeUnit - - time unit
      Returns:
      void
    • restoreAndReplaceAsync

      public RFuture<Void> restoreAndReplaceAsync(byte[] state)
      Description copied from interface: RObjectAsync
      Restores and replaces object if it already exists.
      Specified by:
      restoreAndReplaceAsync in interface RObjectAsync
      Parameters:
      state - - state of the object
      Returns:
      void
    • restoreAndReplaceAsync

      public RFuture<Void> restoreAndReplaceAsync(byte[] state, long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RObjectAsync
      Restores and replaces object if it already exists and set time to live for it.
      Specified by:
      restoreAndReplaceAsync in interface RObjectAsync
      Parameters:
      state - - state of the object
      timeToLive - - time to live of the object
      timeUnit - - time unit
      Returns:
      void
    • dumpAsync

      public RFuture<byte[]> dumpAsync()
      Description copied from interface: RObjectAsync
      Returns dump of object
      Specified by:
      dumpAsync in interface RObjectAsync
      Returns:
      dump
    • touchAsync

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

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

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

      public RFuture<Boolean> copyAsync(String destination)
      Description copied from interface: RObjectAsync
      Copy this object instance to the new instance with a defined name.
      Specified by:
      copyAsync in interface RObjectAsync
      Parameters:
      destination - name of the destination instance
      Returns:
      true if this object instance was copied else false
    • copyAsync

      public RFuture<Boolean> copyAsync(String destination, int database)
      Description copied from interface: RObjectAsync
      Copy this object instance to the new instance with a defined name and database.
      Specified by:
      copyAsync in interface RObjectAsync
      Parameters:
      destination - name of the destination instance
      database - database number
      Returns:
      true if this object instance was copied else false
    • copyAndReplaceAsync

      public RFuture<Boolean> copyAndReplaceAsync(String destination)
      Description copied from interface: RObjectAsync
      Copy this object instance to the new instance with a defined name, and replace it if it already exists.
      Specified by:
      copyAndReplaceAsync in interface RObjectAsync
      Parameters:
      destination - name of the destination instance
      Returns:
      true if this object instance was copied else false
    • copyAndReplaceAsync

      public RFuture<Boolean> copyAndReplaceAsync(String destination, int database)
      Description copied from interface: RObjectAsync
      Copy this object instance to the new instance with a defined name and database, and replace it if it already exists.
      Specified by:
      copyAndReplaceAsync in interface RObjectAsync
      Parameters:
      destination - name of the destination instance
      database - database number
      Returns:
      true if this object instance was copied else false
    • moveAsync

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

      public RFuture<Boolean> deleteAsync()
      Description copied from interface: RObjectAsync
      Delete object in async mode
      Specified by:
      deleteAsync in interface RObjectAsync
      Returns:
      true if object was deleted false if not
    • unlinkAsync

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

      Requires Redis 4.0+

      Specified by:
      unlinkAsync in interface RObjectAsync
      Returns:
      true if it was exist and deleted else false
    • sizeAsync

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

      public AsyncIterator<V> valuesAsync()
      Description copied from interface: RMapAsync
      Returns values of this map using iterable. Values are loaded in batch. Batch size is 10.
      Specified by:
      valuesAsync in interface RMapAsync<K,V>
      Returns:
      Asynchronous Iterable object
    • valuesAsync

      public AsyncIterator<V> valuesAsync(String keyPattern)
      Description copied from interface: RMapAsync
      Returns values of this map using iterable. 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.

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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:
      valuesAsync in interface RMapAsync<K,V>
      Parameters:
      keyPattern - - key pattern
      Returns:
      Asynchronous Iterable object
    • valuesAsync

      public AsyncIterator<V> valuesAsync(String keyPattern, int count)
      Description copied from interface: RMapAsync
      Returns values of this map using iterable. 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.

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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:
      valuesAsync in interface RMapAsync<K,V>
      Parameters:
      keyPattern - - key pattern
      count - - size of values batch
      Returns:
      Asynchronous Iterable object
    • valuesAsync

      public AsyncIterator<V> valuesAsync(int count)
      Description copied from interface: RMapAsync
      Returns values of this map using iterable. Values are loaded in batch. Batch size is defined by count param.
      Specified by:
      valuesAsync in interface RMapAsync<K,V>
      Parameters:
      count - - size of values batch
      Returns:
      Asynchronous Iterable object
    • entrySetAsync

      public AsyncIterator<Map.Entry<K,V>> entrySetAsync()
      Description copied from interface: RMapAsync
      Returns map entries using iterable. Map entries are loaded in batch. Batch size is 10.
      Specified by:
      entrySetAsync in interface RMapAsync<K,V>
      Returns:
      Asynchronous Iterable object
    • entrySetAsync

      public AsyncIterator<Map.Entry<K,V>> entrySetAsync(String keyPattern)
      Description copied from interface: RMapAsync
      Returns map entries using iterable. 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.

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

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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:
      entrySetAsync in interface RMapAsync<K,V>
      Parameters:
      keyPattern - key pattern
      Returns:
      Asynchronous Iterable object
    • entrySetAsync

      public AsyncIterator<Map.Entry<K,V>> entrySetAsync(String keyPattern, int count)
      Description copied from interface: RMapAsync
      Returns map entries using iterable. 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.

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

      Usage example:

           Codec valueCodec = ...
           RMapinvalid input: '<'String, MyObject> map = redissonClient.getMap("simpleMap", new CompositeCodec(StringCodec.INSTANCE, valueCodec, valueCodec));
      
           // or
      
           RMapinvalid input: '<'String, String> map = redissonClient.getMap("simpleMap", StringCodec.INSTANCE);
       
        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:
      entrySetAsync in interface RMapAsync<K,V>
      Parameters:
      keyPattern - key pattern
      count - size of entries batch
      Returns:
      Asynchronous Iterable object
    • entrySetAsync

      public AsyncIterator<Map.Entry<K,V>> entrySetAsync(int count)
      Description copied from interface: RMapAsync
      Returns map entries using iterable. Map entries are loaded in batch. Batch size is defined by count param.
      Specified by:
      entrySetAsync in interface RMapAsync<K,V>
      Parameters:
      count - - size of entries batch
      Returns:
      Asynchronous Iterable object
    • 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
    • remainTimeToLiveAsync

      public RFuture<Long> remainTimeToLiveAsync(K key)
      Description copied from interface: RMapCacheAsync
      Remaining time to live of map entry associated with a key.
      Specified by:
      remainTimeToLiveAsync in interface RMapCacheAsync<K,V>
      Parameters:
      key - - map key
      Returns:
      time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
    • addListenerAsync

      public RFuture<Integer> addListenerAsync(MapEntryListener listener)
      Description copied from interface: RMapCacheAsync
      Adds map entry listener
      Specified by:
      addListenerAsync in interface RMapCacheAsync<K,V>
      Parameters:
      listener - - entry listener
      Returns:
      listener id
      See Also:
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • putAllAsync

      public 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
    • 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
    • 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
    • addAndGetAsync

      public RFuture<V> addAndGetAsync(K key, Number delta)
      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
      delta - the value to add
      Returns:
      the updated value
    • 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
    • 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
    • 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
    • removeListener

      public void removeListener(int listenerId)
      Description copied from interface: RMapCache
      Removes map entry listener
      Specified by:
      removeListener in interface RMapCache<K,V>
      Specified by:
      removeListener in interface RObject
      Parameters:
      listenerId - - listener id
    • remainTimeToLive

      public long remainTimeToLive(K key)
      Description copied from interface: RMapCache
      Remaining time to live of map entry associated with a key.
      Specified by:
      remainTimeToLive in interface RMapCache<K,V>
      Parameters:
      key - - map key
      Returns:
      time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.