JSON.DEBUG MEMORY
Syntax
JSON.DEBUG MEMORY key [path]
- Available in:
- Redis Stack / 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
报告一个值的内存使用情况,单位为字节
必需的参数
key
是解析的关键。
可选参数
path
是JSONPath指定的。默认是根 $。
返回
JSON.DEBUG MEMORY 返回一个整数回复,指定为以字节为单位的值大小。 有关回复的更多信息,请参阅 Redis 序列化协议规范。
示例
Report a value's memory usage in bytes
创建一个JSON文档。
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获取值的字节内存使用情况。
redis> JSON.DEBUG MEMORY item:2
(integer) 253