Interface RJsonStoreReactive<K,V>

Type Parameters:
K - the type of key
V - the type of value
All Superinterfaces:
RExpirableReactive, RObjectReactive

public interface RJsonStoreReactive<K,V> extends RExpirableReactive
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

    • get

      <T> reactor.core.publisher.Mono<T> get(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
    • setIfAbsent

      reactor.core.publisher.Mono<Boolean> setIfAbsent(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
    • setIfExists

      reactor.core.publisher.Mono<Boolean> setIfExists(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
    • compareAndSet

      reactor.core.publisher.Mono<Boolean> compareAndSet(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.
    • getAndSet

      <T> reactor.core.publisher.Mono<T> getAndSet(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
    • set

      reactor.core.publisher.Mono<Void> set(K key, String path, Object value)
      Stores value by specified key and JSONPath.
      Parameters:
      key - entry key
      path - JSON path
      value - value to set
    • stringSize

      reactor.core.publisher.Mono<Long> stringSize(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
    • stringSizeMulti

      reactor.core.publisher.Mono<List<Long>> stringSizeMulti(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
    • stringAppend

      reactor.core.publisher.Mono<Long> stringAppend(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
    • stringAppendMulti

      reactor.core.publisher.Mono<List<Long>> stringAppendMulti(K key, String path, Object value)
      Appends string data to elements specified 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
    • arrayAppend

      reactor.core.publisher.Mono<Long> arrayAppend(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
    • arrayAppendMulti

      reactor.core.publisher.Mono<List<Long>> arrayAppendMulti(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
    • arrayIndex

      reactor.core.publisher.Mono<Long> arrayIndex(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
    • arrayIndexMulti

      reactor.core.publisher.Mono<List<Long>> arrayIndexMulti(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
    • arrayIndex

      reactor.core.publisher.Mono<Long> arrayIndex(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
    • arrayIndexMulti

      reactor.core.publisher.Mono<List<Long>> arrayIndexMulti(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
    • arrayInsert

      reactor.core.publisher.Mono<Long> arrayInsert(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
    • arrayInsertMulti

      reactor.core.publisher.Mono<List<Long>> arrayInsertMulti(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
    • arraySize

      reactor.core.publisher.Mono<Long> arraySize(K key, String path)
      Returns size of array by specified key and JSONPath.
      Parameters:
      key - entry key
      path - JSON path
      Returns:
      size of array
    • arraySizeMulti

      reactor.core.publisher.Mono<List<Long>> arraySizeMulti(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
    • arrayPollLast

      <T> reactor.core.publisher.Mono<T> arrayPollLast(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
    • arrayPollLastMulti

      <T> reactor.core.publisher.Mono<List<T>> arrayPollLastMulti(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
    • arrayPollFirst

      <T> reactor.core.publisher.Mono<T> arrayPollFirst(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
    • arrayPollFirstMulti

      <T> reactor.core.publisher.Mono<List<T>> arrayPollFirstMulti(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
    • arrayPop

      <T> reactor.core.publisher.Mono<T> arrayPop(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
    • arrayPopMulti

      <T> reactor.core.publisher.Mono<List<T>> arrayPopMulti(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
    • arrayTrim

      reactor.core.publisher.Mono<Long> arrayTrim(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
    • arrayTrimMulti

      reactor.core.publisher.Mono<List<Long>> arrayTrimMulti(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
    • clear

      reactor.core.publisher.Mono<Boolean> clear(K key)
      Clears value by specified key
      Parameters:
      key - entry key
      Returns:
      true if successful, or false if entry doesn't exist
    • clear

      reactor.core.publisher.Mono<Long> clear(Set<K> keys)
      Clears json containers by specified keys.
      Parameters:
      keys - entry keys
      Returns:
      number of cleared containers
    • clear

      reactor.core.publisher.Mono<Long> clear(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
    • incrementAndGet

      <T extends Number> reactor.core.publisher.Mono<T> incrementAndGet(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
    • incrementAndGetMulti

      <T extends Number> reactor.core.publisher.Mono<List<T>> incrementAndGetMulti(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
    • merge

      reactor.core.publisher.Mono<Void> merge(K key, String path, Object value)
      Merges value into element by the specified key and JSONPath.
      Parameters:
      key - entry key
      path - JSON path
      value - value to merge
    • countKeys

      reactor.core.publisher.Mono<Long> countKeys(K key)
      Returns keys amount in JSON container by specified key
      Parameters:
      key - entry key
      Returns:
      keys amount
    • countKeys

      reactor.core.publisher.Mono<Long> countKeys(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
    • countKeysMulti

      reactor.core.publisher.Mono<List<Long>> countKeysMulti(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
    • getKeys

      reactor.core.publisher.Mono<List<String>> getKeys(K key)
      Returns list of keys in JSON container by specified key
      Returns:
      list of keys
    • getKeys

      reactor.core.publisher.Mono<List<String>> getKeys(K key, String path)
      Returns list of keys in JSON container by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      list of keys
    • getKeysMulti

      List<reactor.core.publisher.Mono<List<String>>> getKeysMulti(K key, String path)
      Returns list of keys in JSON containers by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      list of keys
    • toggle

      reactor.core.publisher.Mono<Boolean> toggle(K key, String path)
      Toggle Mono value by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      new Mono value
    • toggleMulti

      List<reactor.core.publisher.Mono<Boolean>> toggleMulti(K key, String path)
      Toggle Mono values by specified key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      list of Mono values
    • getType

      reactor.core.publisher.Mono<JsonType> getType(K key)
      Returns type of value
      Returns:
      type of element
    • getType

      reactor.core.publisher.Mono<JsonType> getType(K key, String path)
      Returns type of element specified by key and JSONPath
      Parameters:
      path - JSON path
      Returns:
      type of element
    • delete

      reactor.core.publisher.Mono<Boolean> delete(K key)
      Deletes entry by specified key
      Parameters:
      key - entry key
      Returns:
      true if successful, or false if entry doesn't exist
    • delete

      reactor.core.publisher.Mono<Long> delete(Set<K> keys)
      Deletes entries by specified keys
      Parameters:
      keys - entry keys
      Returns:
      number of deleted elements
    • delete

      reactor.core.publisher.Mono<Long> delete(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
    • sizeInMemory

      reactor.core.publisher.Mono<Long> sizeInMemory(K key)
      Returns size of entry in bytes specified by key.
      Parameters:
      key - entry key
      Returns:
      entry size
    • get

      reactor.core.publisher.Mono<V> get(K key)
      Retrieves value by specified key.
      Parameters:
      key - entry key
      Returns:
      element
    • get

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

      reactor.core.publisher.Mono<Map<K,V>> get(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
    • getAndDelete

      reactor.core.publisher.Mono<V> getAndDelete(K key)
      Retrieves entry value by specified key and removes it.
      Parameters:
      key - entry key
      Returns:
      element
    • setIfAbsent

      reactor.core.publisher.Mono<Boolean> setIfAbsent(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
    • setIfAbsent

      reactor.core.publisher.Mono<Boolean> setIfAbsent(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
    • setIfExists

      reactor.core.publisher.Mono<Boolean> setIfExists(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
    • setIfExists

      reactor.core.publisher.Mono<Boolean> setIfExists(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
    • compareAndSet

      reactor.core.publisher.Mono<Boolean> compareAndSet(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.
    • getAndSet

      reactor.core.publisher.Mono<V> getAndSet(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
    • getAndSet

      reactor.core.publisher.Mono<V> getAndSet(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
    • getAndExpire

      reactor.core.publisher.Mono<V> getAndExpire(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
    • getAndExpire

      reactor.core.publisher.Mono<V> getAndExpire(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
    • getAndClearExpire

      reactor.core.publisher.Mono<V> getAndClearExpire(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
    • set

      reactor.core.publisher.Mono<Void> set(K key, V value)
      Stores value by specified key.
      Parameters:
      key - entry key
      value - value to set
    • set

      reactor.core.publisher.Mono<Void> set(Map<K,V> entries)
      Stores values by specified keys.
      Parameters:
      entries - entries to store
    • set

      reactor.core.publisher.Mono<Void> set(String path, Map<K,V> entries)
      Stores values by specified keys and JSONPath.
      Parameters:
      path - JSONPath
      entries - entries to store
    • set

      reactor.core.publisher.Mono<Void> set(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
    • set

      reactor.core.publisher.Mono<Void> set(Map<K,V> entries, Duration duration)
      Stores values by specified keys with defined expiration duration.
      Parameters:
      entries - entries to store
      duration - expiration duration
    • setAndKeepTTL

      reactor.core.publisher.Mono<Void> setAndKeepTTL(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
    • addListener

      reactor.core.publisher.Mono<Integer> addListener(ObjectListener listener)
      Adds object event listener
      Specified by:
      addListener in interface RObjectReactive
      Parameters:
      listener - object event listener
      Returns:
      listener id
      See Also:
    • remainTimeToLive

      reactor.core.publisher.Mono<Long> remainTimeToLive(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.
    • containsKey

      reactor.core.publisher.Mono<Boolean> containsKey(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
    • readAllKeySet

      reactor.core.publisher.Mono<Set<K>> readAllKeySet()
      Read all keys at once
      Returns:
      keys
    • size

      reactor.core.publisher.Mono<Integer> size()
      Returns entries amount in store
      Returns:
      entries amount
    • getCountDownLatch

      RCountDownLatchReactive getCountDownLatch(K key)
      Returns RCountDownLatch instance associated with key
      Parameters:
      key - - map key
      Returns:
      countdownlatch
    • getPermitExpirableSemaphore

      RPermitExpirableSemaphoreReactive getPermitExpirableSemaphore(K key)
      Returns RPermitExpirableSemaphore instance associated with key
      Parameters:
      key - - map key
      Returns:
      permitExpirableSemaphore
    • getSemaphore

      RSemaphoreReactive getSemaphore(K key)
      Returns RSemaphore instance associated with key
      Parameters:
      key - - map key
      Returns:
      semaphore
    • getFairLock

      RLockReactive getFairLock(K key)
      Returns RLock instance associated with key
      Parameters:
      key - - map key
      Returns:
      fairlock
    • getReadWriteLock

      RReadWriteLockReactive getReadWriteLock(K key)
      Returns RReadWriteLock instance associated with key
      Parameters:
      key - - map key
      Returns:
      readWriteLock
    • getLock

      RLockReactive getLock(K key)
      Returns RLock instance associated with key
      Parameters:
      key - - map key
      Returns:
      lock