memory help 命令
Memory
指令是Redis4.0版本更新的特性,可用于详细的分析内存的使用情况,内存使用诊断,内存碎片回收等工作;
可以通过
memory help
指令打印出
memory
指令的信息,详细信息如下所示:
1) MEMORY <subcommand> arg arg ... arg. Subcommands are: 2) DOCTOR - Return memory problems reports. 3) MALLOC-STATS -- Return internal statistics report from the memory allocator. 4) PURGE -- Attempt to purge dirty pages for reclamation by the allocator. 5) STATS -- Return information about the memory usage of the server. 6) USAGE <key> [SAMPLES <count>] -- Return memory in bytes used by <key> and its value. Nested values are sampled up to <count> times (default: 5). |
具体的指令相关解释为:
-
MEMORY DOCKER
:返回内存问题报告; -
MEMORY MALLOC-STATS
:从内存分配器返回内部统计信息报告; -
MEMORY PURGE
:尝试通过分配器清除脏页以进行回收; -
MEMORY STATS
:返回有关服务器内存使用情况的信息; -
MEMORY USAGE key [SAMPLES count]
:返回 key 使用的字节数及其值, 嵌套值最多采样 count 次(默认值:5);