Interface RJsonStoreAsync<K,V>

Type Parameters:
K - the type of key
V - the type of value
All Superinterfaces:
RExpirableAsync, RObjectAsync
All Known Subinterfaces:
RJsonStore<K,V>

public interface RJsonStoreAsync<K,V> extends RExpirableAsync
JSON Store which stores each entry as key and value. Both are POJO objects. Value is stored as JSON datatype in Redis.

The implementation is available in Redisson PRO only.

Author:
Nikita Koksharov
  • Method Details

    • getAsync

      <T> RFuture<T> getAsync(K key, JsonCodec codec, String... paths)
      Gets value by specified key and JSONPath
      Type Parameters:
      T - the type of object
      Parameters:
      key - entry key
      codec - entry value codec
      paths - JSON paths
      Returns:
      entry value
    • setIfAbsentAsync

      RFuture<Boolean> setIfAbsentAsync(K key, String path, Object value)
      Sets value by specified key and JSONPath only if previous value is empty.
      Parameters:
      key - entry key
      path - JSON path
      value - entry value
      Returns:
      true if successful, or false if value was already set
    • setIfExistsAsync

      RFuture<Boolean> setIfExistsAsync(K key, String path, Object value)
      Sets value by specified key and JSONPath only if previous value is non-empty.
      Parameters:
      key - entry key
      path - JSON path
      value - object
      Returns:
      true if successful, or false if element wasn't set
    • compareAndSetAsync

      RFuture<Boolean> compareAndSetAsync(K key, String path, Object expect, Object update)
      Atomically sets the value to the given updated value by specified key and JSONPath, only if serialized state of the current value equals to serialized state of the expected value.
      Parameters:
      key - entry key
      path - JSON path
      expect - the expected value
      update - the new value
      Returns:
      true if successful; or false if the actual value was not equal to the expected value.
    • getAndSetAsync

      <T> RFuture<T> getAndSetAsync(K key, JsonCodec codec, String path, Object newValue)
      Retrieves current value stored by specified key and JSONPath then replaces it with new value.
      Parameters:
      key - entry key
      codec - entry value codec
      path - JSON path
      newValue - value to set
      Returns:
      previous value
    • setAsync

      RFuture<Void> setAsync(K key, String path, Object value)
      Stores value by specified key and JSONPath.
      Parameters:
      key - entry key
      path - JSON path
      value - value to set
    • stringSizeAsync

      RFuture<Long> stringSizeAsync(K key, String path)
      Returns size of string data by specified key and JSONPath
      Parameters:
      key - entry key
      path - JSON path
      Returns:
      size of string
    • stringSizeMultiAsync

      RFuture<List<Long>> stringSizeMultiAsync(K key, String path)
      Returns list of string data size by specified key and JSONPath. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      Returns:
      list of string data sizes
    • stringAppendAsync

      RFuture<Long> stringAppendAsync(K key, String path, Object value)
      Appends string data to element specified by specified key and JSONPath. Returns new size of string data.
      Parameters:
      key - entry key
      path - JSON path
      value - data
      Returns:
      size of string data
    • stringAppendMultiAsync

      RFuture<List<Long>> stringAppendMultiAsync(K key, String path, Object value)
      Appends string data to elements by specified key and JSONPath. Returns new size of string data. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      value - data
      Returns:
      list of string data sizes
    • arrayAppendAsync

      RFuture<Long> arrayAppendAsync(K key, String path, Object... values)
      Appends values to array by specified key and JSONPath. Returns new size of array.
      Parameters:
      key - entry key
      path - JSON path
      values - values to append
      Returns:
      size of array
    • arrayAppendMultiAsync

      RFuture<List<Long>> arrayAppendMultiAsync(K key, String path, Object... values)
      Appends values to arrays by specified key and JSONPath. Returns new size of arrays. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      values - values to append
      Returns:
      list of arrays size
    • arrayIndexAsync

      RFuture<Long> arrayIndexAsync(K key, String path, Object value)
      Returns index of object in array by specified key and JSONPath. -1 means object not found.
      Parameters:
      key - entry key
      path - JSON path
      value - value to search
      Returns:
      index in array
    • arrayIndexMultiAsync

      RFuture<List<Long>> arrayIndexMultiAsync(K key, String path, Object value)
      Returns index of object in arrays by specified key and JSONPath. -1 means object not found. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      value - value to search
      Returns:
      list of index in arrays
    • arrayIndexAsync

      RFuture<Long> arrayIndexAsync(K key, String path, Object value, long start, long end)
      Returns index of object in array by specified key and JSONPath in range between start (inclusive) and end (exclusive) indexes. -1 means object not found.
      Parameters:
      key - entry key
      path - JSON path
      value - value to search
      start - start index, inclusive
      end - end index, exclusive
      Returns:
      index in array
    • arrayIndexMultiAsync

      RFuture<List<Long>> arrayIndexMultiAsync(K key, String path, Object value, long start, long end)
      Returns index of object in arrays by specified key and JSONPath in range between start (inclusive) and end (exclusive) indexes. -1 means object not found. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      value - value to search
      start - start index, inclusive
      end - end index, exclusive
      Returns:
      list of index in arrays
    • arrayInsertAsync

      RFuture<Long> arrayInsertAsync(K key, String path, long index, Object... values)
      Inserts values into array by specified key and JSONPath. Values are inserted at defined index.
      Parameters:
      key - entry key
      path - JSON path
      index - array index at which values are inserted
      values - values to insert
      Returns:
      size of array
    • arrayInsertMultiAsync

      RFuture<List<Long>> arrayInsertMultiAsync(K key, String path, long index, Object... values)
      Inserts values into arrays by specified key and JSONPath. Values are inserted at defined index. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      index - array index at which values are inserted
      values - values to insert
      Returns:
      list of arrays size
    • arraySizeAsync

      RFuture<Long> arraySizeAsync(K key, String path)
      Returns size of array by specified key and JSONPath.
      Parameters:
      key - entry key
      path - JSON path
      Returns:
      size of array
    • arraySizeMultiAsync

      RFuture<List<Long>> arraySizeMultiAsync(K key, String path)
      Returns size of arrays by specified key and JSONPath. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      Returns:
      list of arrays size
    • arrayPollLastAsync

      <T> RFuture<T> arrayPollLastAsync(K key, JsonCodec codec, String path)
      Polls last element of array by specified key and JSONPath.
      Type Parameters:
      T - the type of object
      Parameters:
      key - entry key
      codec - object codec
      path - JSON path
      Returns:
      last element
    • arrayPollLastMultiAsync

      <T> RFuture<List<T>> arrayPollLastMultiAsync(K key, JsonCodec codec, String path)
      Polls last element of arrays by specified key and JSONPath. Compatible only with enhanced syntax starting with '$' character.
      Type Parameters:
      T - the type of object
      Parameters:
      key - entry key
      codec - object codec
      path - JSON path
      Returns:
      list of last elements
    • arrayPollFirstAsync

      <T> RFuture<T> arrayPollFirstAsync(K key, JsonCodec codec, String path)
      Polls first element of array by specified key and JSONPath.
      Type Parameters:
      T - the type of object
      Parameters:
      key - entry key
      codec - object codec
      path - JSON path
      Returns:
      first element
    • arrayPollFirstMultiAsync

      <T> RFuture<List<T>> arrayPollFirstMultiAsync(K key, JsonCodec codec, String path)
      Polls first element of arrays by specified key and JSONPath. Compatible only with enhanced syntax starting with '$' character.
      Type Parameters:
      T - the type of object
      Parameters:
      key - entry key
      codec - object codec
      path - JSON path
      Returns:
      list of first elements
    • arrayPopAsync

      <T> RFuture<T> arrayPopAsync(K key, JsonCodec codec, String path, long index)
      Pops element located at index of array by specified key and JSONPath.
      Type Parameters:
      T - the type of object
      Parameters:
      key - entry key
      codec - object codec
      path - JSON path
      index - array index
      Returns:
      element
    • arrayPopMultiAsync

      <T> RFuture<List<T>> arrayPopMultiAsync(K key, JsonCodec codec, String path, long index)
      Pops elements located at index of arrays by specified key and JSONPath. Compatible only with enhanced syntax starting with '$' character.
      Type Parameters:
      T - the type of object
      Parameters:
      key - entry key
      codec - object codec
      path - JSON path
      index - array index
      Returns:
      list of elements
    • arrayTrimAsync

      RFuture<Long> arrayTrimAsync(K key, String path, long start, long end)
      Trims array by specified key and JSONPath in range between start (inclusive) and end (inclusive) indexes.
      Parameters:
      key - entry key
      path - JSON path
      start - start index, inclusive
      end - end index, inclusive
      Returns:
      length of array
    • arrayTrimMultiAsync

      RFuture<List<Long>> arrayTrimMultiAsync(K key, String path, long start, long end)
      Trims arrays by specified key and JSONPath in range between start (inclusive) and end (inclusive) indexes. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      start - start index, inclusive
      end - end index, inclusive
      Returns:
      length of array
    • clearAsync

      RFuture<Boolean> clearAsync(K key)
      Clears value by specified key
      Parameters:
      key - entry key
      Returns:
      true if successful, or false if entry doesn't exist
    • clearAsync

      RFuture<Long> clearAsync(Set<K> keys)
      Clears json containers by specified keys.
      Parameters:
      keys - entry keys
      Returns:
      number of cleared containers
    • clearAsync

      RFuture<Long> clearAsync(String path, Set<K> keys)
      Clears json container by specified keys and JSONPath. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      path - JSON path
      keys - entry keys
      Returns:
      number of cleared containers
    • incrementAndGetAsync

      <T extends Number> RFuture<T> incrementAndGetAsync(K key, String path, T delta)
      Increments the current value specified by key and JSONPath.
      Parameters:
      key - entry key
      path - JSON path
      delta - increment value
      Returns:
      the updated value
    • incrementAndGetMultiAsync

      <T extends Number> RFuture<List<T>> incrementAndGetMultiAsync(K key, String path, T delta)
      Increments the current values specified by key and JSONPath. Compatible only with enhanced syntax starting with '$' character.
      Parameters:
      key - entry key
      path - JSON path
      delta - increment value
      Returns:
      list of updated value
    • mergeAsync

      RFuture<Void> mergeAsync(K key, String path, Object value)
      Merges object into element by the specified key and JSONPath.
      Parameters:
      key - entry key
      path - JSON path
      value - value to merge
    • countKeysAsync

      RFuture<Long> countKeysAsync(K key)
      Returns keys amount in JSON container by specified key
      Parameters:
      key - entry key
      Returns:
      keys amount
    • countKeysAsync

      RFuture<Long> countKeysAsync(K key, String path)
      Returns keys amount in JSON container specified by key and JSONPath
      Parameters:
      key - entry key
      path - JSON path
      Returns:
      keys amount
    • countKeysMultiAsync

      RFuture<List<Long>> countKeysMultiAsync(K key, String path)
      Returns list of keys amount in JSON containers specified by key and JSONPath
      Parameters:
      key - entry key
      path - JSON path
      Returns:
      list of keys amount
    • getKeysAsync

      RFuture<List<String>> getKeysAsync(K key)
      Returns list of keys in JSON container by specified key
      Returns:
      list of keys
    • getKeysAsync

      RFuture<List<String>> getKeysAsync(K key, String path)
      Returns list of keys in JSON container by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      list of keys
    • getKeysMultiAsync

      RFuture<List<List<String>>> getKeysMultiAsync(K key, String path)
      Returns list of keys in JSON containers by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      list of keys
    • toggleAsync

      RFuture<Boolean> toggleAsync(K key, String path)
      Toggle boolean value by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      new boolean value
    • toggleMultiAsync

      RFuture<List<Boolean>> toggleMultiAsync(K key, String path)
      Toggle boolean values by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      list of boolean values
    • getTypeAsync

      RFuture<JsonType> getTypeAsync(K key)
      Returns type of value
      Returns:
      type of element
    • getTypeAsync

      RFuture<JsonType> getTypeAsync(K key, String path)
      Returns type of element specified by key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      type of element
    • deleteAsync

      RFuture<Boolean> deleteAsync(K key)
      Deletes entry by specified key
      Parameters:
      key - entry key
      Returns:
      true if successful, or false if entry doesn't exist
    • deleteAsync

      RFuture<Long> deleteAsync(Set<K> keys)
      Deletes JSON elements specified by keys
      Parameters:
      keys - entry keys
      Returns:
      number of deleted elements
    • deleteAsync

      RFuture<Long> deleteAsync(String path, Set<K> keys)
      Deletes JSON elements specified by keys and JSONPath
      Parameters:
      path - JSON path
      keys - entry keys
      Returns:
      number of deleted elements
    • sizeInMemoryAsync

      RFuture<Long> sizeInMemoryAsync(K key)
      Returns size of entry in bytes specified by key.
      Parameters:
      key - entry key
      Returns:
      entry size
    • getAsync

      RFuture<V> getAsync(K key)
      Retrieves value by specified key.
      Parameters:
      key - entry key
      Returns:
      element
    • getAsync

      RFuture<Map<K,V>> getAsync(Set<K> keys)
      Retrieves values by specified keys.
      Parameters:
      keys - entry keys
      Returns:
      map with entries where value mapped by key
    • getAsync

      RFuture<Map<K,V>> getAsync(String path, Set<K> keys)
      Retrieves values by specified keys and JSONPath.
      Parameters:
      path - JSON path
      keys - entry keys
      Returns:
      map with entries where value mapped by key
    • getAndDeleteAsync

      RFuture<V> getAndDeleteAsync(K key)
      Retrieves entry value by specified key and removes it.
      Parameters:
      key - entry key
      Returns:
      element
    • setIfAbsentAsync

      RFuture<Boolean> setIfAbsentAsync(K key, V value)
      Sets value only if entry doesn't exist.
      Parameters:
      key - entry key
      value - value to set
      Returns:
      true if successful, or false if element was already set
    • setIfAbsentAsync

      RFuture<Boolean> setIfAbsentAsync(K key, V value, Duration duration)
      Sets value with defined duration only if entry doesn't exist.
      Parameters:
      key - entry key
      value - value to set
      duration - expiration duration
      Returns:
      true if successful, or false if element was already set
    • setIfExistsAsync

      RFuture<Boolean> setIfExistsAsync(K key, V value)
      Sets value only if entry already exists.
      Parameters:
      key - entry key
      value - value to set
      Returns:
      true if successful, or false if element wasn't set
    • setIfExistsAsync

      RFuture<Boolean> setIfExistsAsync(K key, V value, Duration duration)
      Sets value with expiration duration only if entry already exists.
      Parameters:
      key - entry key
      value - value to set
      duration - expiration duration
      Returns:
      true if successful, or false if element wasn't set
    • compareAndSetAsync

      RFuture<Boolean> compareAndSetAsync(K key, V expect, V update)
      Atomically sets the value to the given updated value by specified key only if serialized state of the current value equals to serialized state of the expected value.
      Parameters:
      key - entry key
      expect - the expected value
      update - the new value
      Returns:
      true if successful; or false if the actual value was not equal to the expected value.
    • getAndSetAsync

      RFuture<V> getAndSetAsync(K key, V newValue)
      Retrieves current value by specified key and replaces it with new value.
      Parameters:
      key - entry key
      newValue - value to set
      Returns:
      previous value
    • getAndSetAsync

      RFuture<V> getAndSetAsync(K key, V value, Duration duration)
      Retrieves current value by specified key and replaces it with value and defines expiration duration.
      Parameters:
      key - entry key
      value - value to set
      duration - expiration duration
      Returns:
      previous value
    • getAndExpireAsync

      RFuture<V> getAndExpireAsync(K key, Duration duration)
      Retrieves current value by specified key and sets an expiration duration for it.

      Requires Redis 6.2.0 and higher.

      Parameters:
      key - entry key
      duration - of object time to live interval
      Returns:
      value
    • getAndExpireAsync

      RFuture<V> getAndExpireAsync(K key, Instant time)
      Retrieves current value by specified key and sets an expiration date for it.

      Requires Redis 6.2.0 and higher.

      Parameters:
      key - entry key
      time - of exact object expiration moment
      Returns:
      value
    • getAndClearExpireAsync

      RFuture<V> getAndClearExpireAsync(K key)
      Retrieves current value by specified key and clears expiration date set before.

      Requires Redis 6.2.0 and higher.

      Parameters:
      key - entry key
      Returns:
      value
    • setAsync

      RFuture<Void> setAsync(K key, V value)
      Stores value by specified key.
      Parameters:
      key - entry key
      value - value to set
    • setAsync

      RFuture<Void> setAsync(Map<K,V> entries)
      Stores values by specified keys.
      Parameters:
      entries - entries to store
    • setAsync

      RFuture<Void> setAsync(String path, Map<K,V> entries)
      Stores values by specified keys and JSONPath.
      Parameters:
      path - JSONPath
      entries - entries to store
    • setAsync

      RFuture<Void> setAsync(K key, V value, Duration duration)
      Stores value by specified key with defined expiration duration.
      Parameters:
      key - entry key
      value - value to set
      duration - expiration duration
    • setAsync

      RFuture<Void> setAsync(Map<K,V> entries, Duration duration)
      Stores values by specified keys with defined expiration duration.
      Parameters:
      entries - entries to store
      duration - expiration duration
    • setAndKeepTTLAsync

      RFuture<Void> setAndKeepTTLAsync(K key, V value)
      Sets value by specified key and keep existing TTL.

      Requires Redis 6.0.0 and higher.

      Parameters:
      value - value to set
      Returns:
      void
    • remainTimeToLiveAsync

      RFuture<Long> remainTimeToLiveAsync(K key)
      Remaining time to live of map entry associated with a key.
      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.
    • containsKeyAsync

      RFuture<Boolean> containsKeyAsync(Object key)
      Returns true if this map contains map entry mapped by specified key, otherwise false
      Parameters:
      key - - map key
      Returns:
      true if this map contains map entry mapped by specified key, otherwise false
    • readAllKeySetAsync

      RFuture<Set<K>> readAllKeySetAsync()
      Read all keys at once
      Returns:
      keys
    • sizeAsync

      RFuture<Integer> sizeAsync()
      Returns entries amount in store
      Returns:
      entries amount
    • addListenerAsync

      RFuture<Integer> addListenerAsync(ObjectListener listener)
      Adds object event listener
      Specified by:
      addListenerAsync in interface RObjectAsync
      Parameters:
      listener - - object event listener
      Returns:
      listener id
      See Also: