Package org.redisson.api
Interface RJsonStoreAsync<K,V>
- Type Parameters:
K- the type of keyV- the type of value
- All Superinterfaces:
RExpirableAsync,RObjectAsync
- All Known Subinterfaces:
RJsonStore<K,V>
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 Summary
Modifier and TypeMethodDescriptionaddListenerAsync(ObjectListener listener) Adds object event listenerarrayAppendAsync(K key, String path, Object... values) Appends values to array by specified key and JSONPath.arrayAppendMultiAsync(K key, String path, Object... values) Appends values to arrays by specified key and JSONPath.arrayIndexAsync(K key, String path, Object value) Returns index of object in array by specified key and JSONPatharrayIndexAsync(K key, String path, Object value, long start, long end) Returns index of object in array by specified key and JSONPath in range betweenstart(inclusive) andend(exclusive) indexesarrayIndexMultiAsync(K key, String path, Object value) Returns index of object in arrays by specified key and JSONPatharrayIndexMultiAsync(K key, String path, Object value, long start, long end) Returns index of object in arrays by specified key and JSONPath in range betweenstart(inclusive) andend(exclusive) indexesarrayInsertAsync(K key, String path, long index, Object... values) Inserts values into array by specified key and JSONPath.arrayInsertMultiAsync(K key, String path, long index, Object... values) Inserts values into arrays by specified key and JSONPath.<T> RFuture<T> arrayPollFirstAsync(K key, JsonCodec codec, String path) Polls first element of array by specified key and JSONPath.arrayPollFirstMultiAsync(K key, JsonCodec codec, String path) Polls first element of arrays by specified key and JSONPath.<T> RFuture<T> arrayPollLastAsync(K key, JsonCodec codec, String path) Polls last element of array by specified key and JSONPath.arrayPollLastMultiAsync(K key, JsonCodec codec, String path) Polls last element of arrays by specified key and JSONPath.<T> RFuture<T> arrayPopAsync(K key, JsonCodec codec, String path, long index) Pops element located at index of array by specified key and JSONPath.arrayPopMultiAsync(K key, JsonCodec codec, String path, long index) Pops elements located at index of arrays by specified key and JSONPath.arraySizeAsync(K key, String path) Returns size of array by specified key and JSONPath.arraySizeMultiAsync(K key, String path) Returns size of arrays by specified key and JSONPath.arrayTrimAsync(K key, String path, long start, long end) Trims array by specified key and JSONPath in range betweenstart(inclusive) andend(inclusive) indexes.arrayTrimMultiAsync(K key, String path, long start, long end) Trims arrays by specified key and JSONPath in range betweenstart(inclusive) andend(inclusive) indexes.clearAsync(String path, Set<K> keys) Clears json container by specified keys and JSONPath.clearAsync(Set<K> keys) Clears json containers by specified keys.clearAsync(K key) Clears value by specified keycompareAndSetAsync(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.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.containsKeyAsync(Object key) Returnstrueif this map contains map entry mapped by specifiedkey, otherwisefalsecountKeysAsync(K key) Returns keys amount in JSON container by specified keycountKeysAsync(K key, String path) Returns keys amount in JSON container specified by key and JSONPathcountKeysMultiAsync(K key, String path) Returns list of keys amount in JSON containers specified by key and JSONPathdeleteAsync(String path, Set<K> keys) Deletes JSON elements specified by keys and JSONPathdeleteAsync(Set<K> keys) Deletes JSON elements specified by keysdeleteAsync(K key) Deletes entry by specified keygetAndClearExpireAsync(K key) Retrieves current value by specified key and clears expiration date set before.getAndDeleteAsync(K key) Retrieves entry value by specified key and removes it.getAndExpireAsync(K key, Duration duration) Retrieves current value by specified key and sets an expiration duration for it.getAndExpireAsync(K key, Instant time) Retrieves current value by specified key and sets an expiration date for it.<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.getAndSetAsync(K key, V newValue) Retrieves current value by specified key and replaces it with new value.getAndSetAsync(K key, V value, Duration duration) Retrieves current value by specified key and replaces it with value and defines expirationduration.Retrieves values by specified keys and JSONPath.Retrieves values by specified keys.Retrieves value by specified key.<T> RFuture<T> Gets value by specified key and JSONPathgetKeysAsync(K key) Returns list of keys in JSON container by specified keygetKeysAsync(K key, String path) Returns list of keys in JSON container by specified key and JSONPathgetKeysMultiAsync(K key, String path) Returns list of keys in JSON containers by specified key and JSONPathgetTypeAsync(K key) Returns type of valuegetTypeAsync(K key, String path) Returns type of element specified by key and JSONPathincrementAndGetAsync(K key, String path, T delta) Increments the current value specified by key and JSONPath.incrementAndGetMultiAsync(K key, String path, T delta) Increments the current values specified by key and JSONPath.mergeAsync(K key, String path, Object value) Merges object into element by the specified key and JSONPath.Read all keys at onceremainTimeToLiveAsync(K key) Remaining time to live of map entry associated with akey.setAndKeepTTLAsync(K key, V value) Sets value by specified key and keep existing TTL.Stores values by specified keys and JSONPath.Stores values by specified keys.Stores values by specified keys with defined expiration duration.Stores value by specified key and JSONPath.Stores value by specified key.Stores value by specified key with defined expiration duration.setIfAbsentAsync(K key, String path, Object value) Sets value by specified key and JSONPath only if previous value is empty.setIfAbsentAsync(K key, V value) Sets value only if entry doesn't exist.setIfAbsentAsync(K key, V value, Duration duration) Sets value with defined duration only if entry doesn't exist.setIfExistsAsync(K key, String path, Object value) Sets value by specified key and JSONPath only if previous value is non-empty.setIfExistsAsync(K key, V value) Sets value only if entry already exists.setIfExistsAsync(K key, V value, Duration duration) Setsvaluewith expirationdurationonly if entry already exists.Returns entries amount in storesizeInMemoryAsync(K key) Returns size of entry in bytes specified by key.stringAppendAsync(K key, String path, Object value) Appends string data to element specified by specified key and JSONPath.stringAppendMultiAsync(K key, String path, Object value) Appends string data to elements by specified key and JSONPath.stringSizeAsync(K key, String path) Returns size of string data by specified key and JSONPathstringSizeMultiAsync(K key, String path) Returns list of string data size by specified key and JSONPath.toggleAsync(K key, String path) Toggle boolean value by specified key and JSONPathtoggleMultiAsync(K key, String path) Toggle boolean values by specified key and JSONPathMethods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsyncMethods inherited from interface org.redisson.api.RObjectAsync
copyAndReplaceAsync, copyAndReplaceAsync, copyAsync, copyAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
getAsync
Gets value by specified key and JSONPath- Type Parameters:
T- the type of object- Parameters:
key- entry keycodec- entry value codecpaths- JSON paths- Returns:
- entry value
-
setIfAbsentAsync
Sets value by specified key and JSONPath only if previous value is empty.- Parameters:
key- entry keypath- JSON pathvalue- entry value- Returns:
trueif successful, orfalseif value was already set
-
setIfExistsAsync
Sets value by specified key and JSONPath only if previous value is non-empty.- Parameters:
key- entry keypath- JSON pathvalue- object- Returns:
trueif successful, orfalseif element wasn't set
-
compareAndSetAsync
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 keypath- JSON pathexpect- the expected valueupdate- the new value- Returns:
trueif successful; orfalseif the actual value was not equal to the expected value.
-
getAndSetAsync
Retrieves current value stored by specified key and JSONPath then replaces it with new value.- Parameters:
key- entry keycodec- entry value codecpath- JSON pathnewValue- value to set- Returns:
- previous value
-
setAsync
Stores value by specified key and JSONPath.- Parameters:
key- entry keypath- JSON pathvalue- value to set
-
stringSizeAsync
Returns size of string data by specified key and JSONPath- Parameters:
key- entry keypath- JSON path- Returns:
- size of string
-
stringSizeMultiAsync
Returns list of string data size by specified key and JSONPath. Compatible only with enhanced syntax starting with '$' character.- Parameters:
key- entry keypath- JSON path- Returns:
- list of string data sizes
-
stringAppendAsync
Appends string data to element specified by specified key and JSONPath. Returns new size of string data.- Parameters:
key- entry keypath- JSON pathvalue- data- Returns:
- size of string data
-
stringAppendMultiAsync
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 keypath- JSON pathvalue- data- Returns:
- list of string data sizes
-
arrayAppendAsync
Appends values to array by specified key and JSONPath. Returns new size of array.- Parameters:
key- entry keypath- JSON pathvalues- values to append- Returns:
- size of array
-
arrayAppendMultiAsync
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 keypath- JSON pathvalues- values to append- Returns:
- list of arrays size
-
arrayIndexAsync
Returns index of object in array by specified key and JSONPath. -1 means object not found.- Parameters:
key- entry keypath- JSON pathvalue- value to search- Returns:
- index in array
-
arrayIndexMultiAsync
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 keypath- JSON pathvalue- value to search- Returns:
- list of index in arrays
-
arrayIndexAsync
Returns index of object in array by specified key and JSONPath in range betweenstart(inclusive) andend(exclusive) indexes. -1 means object not found.- Parameters:
key- entry keypath- JSON pathvalue- value to searchstart- start index, inclusiveend- end index, exclusive- Returns:
- index in array
-
arrayIndexMultiAsync
Returns index of object in arrays by specified key and JSONPath in range betweenstart(inclusive) andend(exclusive) indexes. -1 means object not found. Compatible only with enhanced syntax starting with '$' character.- Parameters:
key- entry keypath- JSON pathvalue- value to searchstart- start index, inclusiveend- end index, exclusive- Returns:
- list of index in arrays
-
arrayInsertAsync
Inserts values into array by specified key and JSONPath. Values are inserted at definedindex.- Parameters:
key- entry keypath- JSON pathindex- array index at which values are insertedvalues- values to insert- Returns:
- size of array
-
arrayInsertMultiAsync
Inserts values into arrays by specified key and JSONPath. Values are inserted at definedindex. Compatible only with enhanced syntax starting with '$' character.- Parameters:
key- entry keypath- JSON pathindex- array index at which values are insertedvalues- values to insert- Returns:
- list of arrays size
-
arraySizeAsync
Returns size of array by specified key and JSONPath.- Parameters:
key- entry keypath- JSON path- Returns:
- size of array
-
arraySizeMultiAsync
Returns size of arrays by specified key and JSONPath. Compatible only with enhanced syntax starting with '$' character.- Parameters:
key- entry keypath- JSON path- Returns:
- list of arrays size
-
arrayPollLastAsync
Polls last element of array by specified key and JSONPath.- Type Parameters:
T- the type of object- Parameters:
key- entry keycodec- object codecpath- JSON path- Returns:
- last element
-
arrayPollLastMultiAsync
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 keycodec- object codecpath- JSON path- Returns:
- list of last elements
-
arrayPollFirstAsync
Polls first element of array by specified key and JSONPath.- Type Parameters:
T- the type of object- Parameters:
key- entry keycodec- object codecpath- JSON path- Returns:
- first element
-
arrayPollFirstMultiAsync
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 keycodec- object codecpath- JSON path- Returns:
- list of first elements
-
arrayPopAsync
Pops element located at index of array by specified key and JSONPath.- Type Parameters:
T- the type of object- Parameters:
key- entry keycodec- object codecpath- JSON pathindex- array index- Returns:
- element
-
arrayPopMultiAsync
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 keycodec- object codecpath- JSON pathindex- array index- Returns:
- list of elements
-
arrayTrimAsync
Trims array by specified key and JSONPath in range betweenstart(inclusive) andend(inclusive) indexes.- Parameters:
key- entry keypath- JSON pathstart- start index, inclusiveend- end index, inclusive- Returns:
- length of array
-
arrayTrimMultiAsync
Trims arrays by specified key and JSONPath in range betweenstart(inclusive) andend(inclusive) indexes. Compatible only with enhanced syntax starting with '$' character.- Parameters:
key- entry keypath- JSON pathstart- start index, inclusiveend- end index, inclusive- Returns:
- length of array
-
clearAsync
Clears value by specified key- Parameters:
key- entry key- Returns:
trueif successful, orfalseif entry doesn't exist
-
clearAsync
Clears json containers by specified keys.- Parameters:
keys- entry keys- Returns:
- number of cleared containers
-
clearAsync
Clears json container by specified keys and JSONPath. Compatible only with enhanced syntax starting with '$' character.- Parameters:
path- JSON pathkeys- entry keys- Returns:
- number of cleared containers
-
incrementAndGetAsync
Increments the current value specified by key and JSONPath.- Parameters:
key- entry keypath- JSON pathdelta- increment value- Returns:
- the updated value
-
incrementAndGetMultiAsync
Increments the current values specified by key and JSONPath. Compatible only with enhanced syntax starting with '$' character.- Parameters:
key- entry keypath- JSON pathdelta- increment value- Returns:
- list of updated value
-
mergeAsync
Merges object into element by the specified key and JSONPath.- Parameters:
key- entry keypath- JSON pathvalue- value to merge
-
countKeysAsync
Returns keys amount in JSON container by specified key- Parameters:
key- entry key- Returns:
- keys amount
-
countKeysAsync
Returns keys amount in JSON container specified by key and JSONPath- Parameters:
key- entry keypath- JSON path- Returns:
- keys amount
-
countKeysMultiAsync
Returns list of keys amount in JSON containers specified by key and JSONPath- Parameters:
key- entry keypath- JSON path- Returns:
- list of keys amount
-
getKeysAsync
Returns list of keys in JSON container by specified key- Returns:
- list of keys
-
getKeysAsync
Returns list of keys in JSON container by specified key and JSONPath- Parameters:
path- JSON path- Returns:
- list of keys
-
getKeysMultiAsync
Returns list of keys in JSON containers by specified key and JSONPath- Parameters:
path- JSON path- Returns:
- list of keys
-
toggleAsync
Toggle boolean value by specified key and JSONPath- Parameters:
path- JSON path- Returns:
- new boolean value
-
toggleMultiAsync
Toggle boolean values by specified key and JSONPath- Parameters:
path- JSON path- Returns:
- list of boolean values
-
getTypeAsync
Returns type of value- Returns:
- type of element
-
getTypeAsync
Returns type of element specified by key and JSONPath- Parameters:
path- JSON path- Returns:
- type of element
-
deleteAsync
Deletes entry by specified key- Parameters:
key- entry key- Returns:
trueif successful, orfalseif entry doesn't exist
-
deleteAsync
Deletes JSON elements specified by keys- Parameters:
keys- entry keys- Returns:
- number of deleted elements
-
deleteAsync
Deletes JSON elements specified by keys and JSONPath- Parameters:
path- JSON pathkeys- entry keys- Returns:
- number of deleted elements
-
sizeInMemoryAsync
Returns size of entry in bytes specified by key.- Parameters:
key- entry key- Returns:
- entry size
-
getAsync
Retrieves value by specified key.- Parameters:
key- entry key- Returns:
- element
-
getAsync
Retrieves values by specified keys.- Parameters:
keys- entry keys- Returns:
- map with entries where value mapped by key
-
getAsync
Retrieves values by specified keys and JSONPath.- Parameters:
path- JSON pathkeys- entry keys- Returns:
- map with entries where value mapped by key
-
getAndDeleteAsync
Retrieves entry value by specified key and removes it.- Parameters:
key- entry key- Returns:
- element
-
setIfAbsentAsync
Sets value only if entry doesn't exist.- Parameters:
key- entry keyvalue- value to set- Returns:
trueif successful, orfalseif element was already set
-
setIfAbsentAsync
Sets value with defined duration only if entry doesn't exist.- Parameters:
key- entry keyvalue- value to setduration- expiration duration- Returns:
trueif successful, orfalseif element was already set
-
setIfExistsAsync
Sets value only if entry already exists.- Parameters:
key- entry keyvalue- value to set- Returns:
trueif successful, orfalseif element wasn't set
-
setIfExistsAsync
Setsvaluewith expirationdurationonly if entry already exists.- Parameters:
key- entry keyvalue- value to setduration- expiration duration- Returns:
trueif successful, orfalseif element wasn't set
-
compareAndSetAsync
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 keyexpect- the expected valueupdate- the new value- Returns:
trueif successful; orfalseif the actual value was not equal to the expected value.
-
getAndSetAsync
Retrieves current value by specified key and replaces it with new value.- Parameters:
key- entry keynewValue- value to set- Returns:
- previous value
-
getAndSetAsync
Retrieves current value by specified key and replaces it with value and defines expirationduration.- Parameters:
key- entry keyvalue- value to setduration- expiration duration- Returns:
- previous value
-
getAndExpireAsync
Retrieves current value by specified key and sets an expiration duration for it.Requires Redis 6.2.0 and higher.
- Parameters:
key- entry keyduration- of object time to live interval- Returns:
- value
-
getAndExpireAsync
Retrieves current value by specified key and sets an expiration date for it.Requires Redis 6.2.0 and higher.
- Parameters:
key- entry keytime- of exact object expiration moment- Returns:
- value
-
getAndClearExpireAsync
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
Stores value by specified key.- Parameters:
key- entry keyvalue- value to set
-
setAsync
Stores values by specified keys.- Parameters:
entries- entries to store
-
setAsync
Stores values by specified keys and JSONPath.- Parameters:
path- JSONPathentries- entries to store
-
setAsync
Stores value by specified key with defined expiration duration.- Parameters:
key- entry keyvalue- value to setduration- expiration duration
-
setAsync
Stores values by specified keys with defined expiration duration.- Parameters:
entries- entries to storeduration- expiration duration
-
setAndKeepTTLAsync
Sets value by specified key and keep existing TTL.Requires Redis 6.0.0 and higher.
- Parameters:
value- value to set- Returns:
- void
-
remainTimeToLiveAsync
Remaining time to live of map entry associated with akey.- 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
Returnstrueif this map contains map entry mapped by specifiedkey, otherwisefalse- Parameters:
key- - map key- Returns:
trueif this map contains map entry mapped by specifiedkey, otherwisefalse
-
readAllKeySetAsync
Read all keys at once- Returns:
- keys
-
sizeAsync
Returns entries amount in store- Returns:
- entries amount
-
addListenerAsync
Adds object event listener- Specified by:
addListenerAsyncin interfaceRObjectAsync- Parameters:
listener- - object event listener- Returns:
- listener id
- See Also:
-