K
- Key type.V
- Value type.public interface RedisJsonReactiveCommands<K,V>
Modifier and Type | Method and Description |
---|---|
Flux<Long> |
jsonArrappend(K key,
JsonPath jsonPath,
JsonValue... values)
Append the JSON values into the array at a given
JsonPath after the last element in a said array. |
Flux<Long> |
jsonArrappend(K key,
JsonValue... values)
Append the JSON values into the array at the
JsonPath.ROOT_PATH after the last element in a said array. |
Flux<Long> |
jsonArrindex(K key,
JsonPath jsonPath,
JsonValue value)
|
Flux<Long> |
jsonArrindex(K key,
JsonPath jsonPath,
JsonValue value,
JsonRangeArgs range)
|
Flux<Long> |
jsonArrinsert(K key,
JsonPath jsonPath,
int index,
JsonValue... values)
|
Flux<Long> |
jsonArrlen(K key)
Report the length of the JSON array at a the
JsonPath.ROOT_PATH |
Flux<Long> |
jsonArrlen(K key,
JsonPath jsonPath)
Report the length of the JSON array at a given
JsonPath |
Flux<JsonValue> |
jsonArrpop(K key)
Remove and return
JsonValue at index -1 (last element) in the array at the JsonPath.ROOT_PATH |
Flux<JsonValue> |
jsonArrpop(K key,
JsonPath jsonPath)
|
Flux<JsonValue> |
jsonArrpop(K key,
JsonPath jsonPath,
int index)
|
Flux<Long> |
jsonArrtrim(K key,
JsonPath jsonPath,
JsonRangeArgs range)
Trim an array at a given
JsonPath so that it contains only the specified inclusive range of elements. |
Mono<Long> |
jsonClear(K key)
Clear container values (arrays/objects) and set numeric values to 0 at the
JsonPath.ROOT_PATH |
Mono<Long> |
jsonClear(K key,
JsonPath jsonPath)
Clear container values (arrays/objects) and set numeric values to 0
|
Mono<Long> |
jsonDel(K key)
Deletes a value inside the JSON document at the
JsonPath.ROOT_PATH |
Mono<Long> |
jsonDel(K key,
JsonPath jsonPath)
Deletes a value inside the JSON document at a given
JsonPath |
Flux<JsonValue> |
jsonGet(K key,
JsonGetArgs options,
JsonPath... jsonPaths)
Return the value at the specified path in JSON serialized form.
|
Flux<JsonValue> |
jsonGet(K key,
JsonPath... jsonPaths)
Return the value at the specified path in JSON serialized form.
|
Mono<String> |
jsonMerge(K key,
JsonPath jsonPath,
JsonValue value)
|
Flux<JsonValue> |
jsonMGet(JsonPath jsonPath,
K... keys)
Return the values at the specified path from multiple key arguments.
|
Mono<String> |
jsonMSet(List<JsonMsetArgs<K,V>> arguments)
Set or update one or more JSON values according to the specified
JsonMsetArgs
JSON.MSET is atomic, hence, all given additions or updates are either applied or not. |
Flux<Number> |
jsonNumincrby(K key,
JsonPath jsonPath,
Number number)
Increment the number value stored at the specified
JsonPath in the JSON document by the provided increment. |
Flux<V> |
jsonObjkeys(K key)
Return the keys in the JSON document that are referenced by the
JsonPath.ROOT_PATH |
Flux<V> |
jsonObjkeys(K key,
JsonPath jsonPath)
Return the keys in the JSON document that are referenced by the given
JsonPath |
Flux<Long> |
jsonObjlen(K key)
Report the number of keys in the JSON object at the
JsonPath.ROOT_PATH and for the provided key |
Flux<Long> |
jsonObjlen(K key,
JsonPath jsonPath)
Report the number of keys in the JSON object at the specified
JsonPath and for the provided key |
Mono<String> |
jsonSet(K key,
JsonPath jsonPath,
JsonValue value)
Sets the JSON value at a given
JsonPath in the JSON document using defaults for the JsonSetArgs . |
Mono<String> |
jsonSet(K key,
JsonPath jsonPath,
JsonValue value,
JsonSetArgs options)
Sets the JSON value at a given
JsonPath in the JSON document. |
Flux<Long> |
jsonStrappend(K key,
JsonPath jsonPath,
JsonValue value)
Append the json-string values to the string at the provided
JsonPath in the JSON document. |
Flux<Long> |
jsonStrappend(K key,
JsonValue value)
Append the json-string values to the string at the
JsonPath.ROOT_PATH in the JSON document. |
Flux<Long> |
jsonStrlen(K key)
Report the length of the JSON String at the
JsonPath.ROOT_PATH in the JSON document. |
Flux<Long> |
jsonStrlen(K key,
JsonPath jsonPath)
Report the length of the JSON String at the provided
JsonPath in the JSON document. |
Flux<Long> |
jsonToggle(K key,
JsonPath jsonPath)
Toggle a Boolean value stored at the provided
JsonPath in the JSON document. |
Flux<JsonType> |
jsonType(K key)
Report the type of JSON value at the
JsonPath.ROOT_PATH in the JSON document. |
Flux<JsonType> |
jsonType(K key,
JsonPath jsonPath)
Report the type of JSON value at the provided
JsonPath in the JSON document. |
Flux<Long> jsonArrappend(K key, JsonPath jsonPath, JsonValue... values)
JsonPath
after the last element in a said array.Flux<Long> jsonArrappend(K key, JsonValue... values)
JsonPath.ROOT_PATH
after the last element in a said array.key
- the key holding the JSON document.values
- one or more JsonValue
to be appended.Flux<Long> jsonArrindex(K key, JsonPath jsonPath, JsonValue value, JsonRangeArgs range)
JsonValue
in an array at a given JsonPath
and return its index.key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the array inside the document.value
- the JsonValue
to search for.range
- the JsonRangeArgs
to search within.Flux<Long> jsonArrindex(K key, JsonPath jsonPath, JsonValue value)
JsonValue
in an array at a given JsonPath
and return its index. This
method uses defaults for the start and end indexes, see JsonRangeArgs.DEFAULT_START_INDEX
and
JsonRangeArgs.DEFAULT_END_INDEX
.Flux<Long> jsonArrinsert(K key, JsonPath jsonPath, int index, JsonValue... values)
JsonValue
s into the array at a given JsonPath
before the provided index, shifting the existing
elements to the rightkey
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the array inside the document.index
- the index before which the new elements will be inserted.values
- one or more JsonValue
s to be inserted.Flux<Long> jsonArrlen(K key, JsonPath jsonPath)
JsonPath
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the array inside the document.Flux<Long> jsonArrlen(K key)
JsonPath.ROOT_PATH
key
- the key holding the JSON document.Flux<JsonValue> jsonArrpop(K key, JsonPath jsonPath, int index)
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the array inside the document.index
- the index of the element to be removed. Default is -1, meaning the last element. Out-of-range indexes round
to their respective array ends. Popping an empty array returns null.Flux<JsonValue> jsonArrpop(K key, JsonPath jsonPath)
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the array inside the document.Flux<JsonValue> jsonArrpop(K key)
JsonValue
at index -1 (last element) in the array at the JsonPath.ROOT_PATH
key
- the key holding the JSON document.Flux<Long> jsonArrtrim(K key, JsonPath jsonPath, JsonRangeArgs range)
JsonPath
so that it contains only the specified inclusive range of elements. All
elements with indexes smaller than the start range and all elements with indexes bigger than the end range are trimmed.
Behavior as of RedisJSON v2.0:
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the array inside the document.range
- the JsonRangeArgs
to trim by.Mono<Long> jsonClear(K key, JsonPath jsonPath)
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the value to clear.Mono<Long> jsonClear(K key)
JsonPath.ROOT_PATH
key
- the key holding the JSON document.Mono<Long> jsonDel(K key, JsonPath jsonPath)
JsonPath
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the value to clear.Mono<Long> jsonDel(K key)
JsonPath.ROOT_PATH
key
- the key holding the JSON document.Flux<JsonValue> jsonGet(K key, JsonGetArgs options, JsonPath... jsonPaths)
When using a single JSONPath, the root of the matching values is a JSON string with a top-level array of serialized JSON value. In contrast, a legacy path returns a single value.
When using multiple JSONPath arguments, the root of the matching values is a JSON string with a top-level object, with each object value being a top-level array of serialized JSON value. In contrast, if all paths are legacy paths, each object value is a single serialized JSON value. If there are multiple paths that include both legacy path and JSONPath, the returned value conforms to the JSONPath version (an array of values).
key
- the key holding the JSON document.options
- the JsonGetArgs
to use.jsonPaths
- the JsonPath
s to use to identify the values to get.Flux<JsonValue> jsonGet(K key, JsonPath... jsonPaths)
JsonGetArgs
.
When using a single JSONPath, the root of the matching values is a JSON string with a top-level array of serialized JSON value. In contrast, a legacy path returns a single value.
When using multiple JSONPath arguments, the root of the matching values is a JSON string with a top-level object, with each object value being a top-level array of serialized JSON value. In contrast, if all paths are legacy paths, each object value is a single serialized JSON value. If there are multiple paths that include both legacy path and JSONPath, the returned value conforms to the JSONPath version (an array of values).
key
- the key holding the JSON document.jsonPaths
- the JsonPath
s to use to identify the values to get.Mono<String> jsonMerge(K key, JsonPath jsonPath, JsonValue value)
JsonValue
with the value matching JsonPath
. Consequently, JSON values at matching paths are
updated, deleted, or expanded with new children.
Merging is done according to the following rules per JSON value in the value argument while considering the corresponding original value if it exists:
This command complies with RFC7396 "Json Merge Patch"
Flux<JsonValue> jsonMGet(JsonPath jsonPath, K... keys)
Mono<String> jsonMSet(List<JsonMsetArgs<K,V>> arguments)
JsonMsetArgs
JSON.MSET is atomic, hence, all given additions or updates are either applied or not. It is not possible for clients to see that some keys were updated while others are unchanged.
A JSON value is a hierarchical structure. If you change a value in a specific path - nested values are affected.
arguments
- the JsonMsetArgs
specifying the values to change.Flux<Number> jsonNumincrby(K key, JsonPath jsonPath, Number number)
JsonPath
in the JSON document by the provided increment.Flux<V> jsonObjkeys(K key, JsonPath jsonPath)
JsonPath
Flux<V> jsonObjkeys(K key)
JsonPath.ROOT_PATH
key
- the key holding the JSON document.JsonPath
.Flux<Long> jsonObjlen(K key, JsonPath jsonPath)
JsonPath
and for the provided keykey
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the value(s) whose key(s) we want to countFlux<Long> jsonObjlen(K key)
JsonPath.ROOT_PATH
and for the provided keykey
- the key holding the JSON document.Mono<String> jsonSet(K key, JsonPath jsonPath, JsonValue value, JsonSetArgs options)
JsonPath
in the JSON document.
For new Redis keys, the path must be the root. For existing keys, when the entire path exists, the value that it contains is replaced with the JSON value. For existing keys, when the path exists, except for the last element, a new child is added with the JSON value.
Adds a key (with its respective value) to a JSON Object (in a RedisJSON data type key) only if it is the last child in the path, or it is the parent of a new child being added in the path. Optional arguments NX and XX modify this behavior for both new RedisJSON data type keys and the JSON Object keys in them.
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the value(s) where we want to set the value.value
- the JsonValue
to set.options
- the JsonSetArgs
the options for setting the value.JsonSetArgs
conditions are not met.Mono<String> jsonSet(K key, JsonPath jsonPath, JsonValue value)
JsonPath
in the JSON document using defaults for the JsonSetArgs
.
For new Redis keys the path must be the root. For existing keys, when the entire path exists, the value that it contains is replaced with the JSON value. For existing keys, when the path exists, except for the last element, a new child is added with the JSON value.
Adds a key (with its respective value) to a JSON Object (in a RedisJSON data type key) only if it is the last child in the path, or it is the parent of a new child being added in the path. Optional arguments NX and XX modify this behavior for both new RedisJSON data type keys and the JSON Object keys in them.
key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the value(s) where we want to set the value.value
- the JsonValue
to set.JsonSetArgs
conditions are not met.Flux<Long> jsonStrappend(K key, JsonPath jsonPath, JsonValue value)
JsonPath
in the JSON document.Flux<Long> jsonStrappend(K key, JsonValue value)
JsonPath.ROOT_PATH
in the JSON document.key
- the key holding the JSON document.value
- the JsonValue
to append.Flux<Long> jsonStrlen(K key, JsonPath jsonPath)
JsonPath
in the JSON document.Flux<Long> jsonStrlen(K key)
JsonPath.ROOT_PATH
in the JSON document.key
- the key holding the JSON document.JsonPath
, or null if the value
ath the desired path is not a string.Flux<Long> jsonToggle(K key, JsonPath jsonPath)
JsonPath
in the JSON document.key
- the key holding the JSON document.jsonPath
- the JsonPath
pointing to the value(s).Flux<JsonType> jsonType(K key, JsonPath jsonPath)
JsonPath
in the JSON document.Flux<JsonType> jsonType(K key)
JsonPath.ROOT_PATH
in the JSON document.key
- the key holding the JSON document.JsonPath
Copyright © 2024 lettuce.io. All rights reserved.