JSON.DEBUG MEMORY

Syntax
JSON.DEBUG MEMORY key [path]
Available in:
Redis Open Source / JSON 1.0.0
Time complexity:
O(N) when path is evaluated to a single value, where N is the size of the value, O(N) when path is evaluated to multiple values, where N is the size of the key
ACL categories:
@json, @read,

Report a value's memory usage in bytes

Warning:
The actual total memory consumption by a key could be much lower than the value reported by this command because of an internal JSON string reuse mechanism. For more information, see the JSON memory usage page.

Examples

Required arguments

key

is key to parse.

Optional arguments

path

is JSONPath to specify. Default is root $.

Return

JSON.DEBUG MEMORY returns an integer reply specified as the value size in bytes. For more information about replies, see Redis serialization protocol specification.

Examples

Report a value's memory usage in bytes

Create a JSON document.

redis> JSON.SET item:2 $ '{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","connection":{"wireless":true,"type":"Bluetooth"},"price":64.99,"stock":17,"colors":["black","white"], "max_level":[80, 100, 120]}'
OK

Get the values' memory usage in bytes.

redis> JSON.DEBUG MEMORY item:2
(integer) 573

See also

JSON.SET | JSON.ARRLEN


RATE THIS PAGE
Back to top ↑
OSZAR »