diff options
author | Itamar Haber <itamar@redislabs.com> | 2021-01-04 17:02:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 17:02:57 +0200 |
commit | 9dcdc7e79a25968fcdfde09c7ca72a2012a1febf (patch) | |
tree | ae614234406e8194e5263c5e6d1c96f826a31614 /src/object.c | |
parent | 10f94b0ab12f9315939dcccf39d64b9388c0c7fa (diff) | |
download | redis-9dcdc7e79a25968fcdfde09c7ca72a2012a1febf.tar.gz |
HELP subcommand, continued (#5531)
* man-like consistent long formatting
* Uppercases commands, subcommands and options
* Adds 'HELP' to HELP for all
* Lexicographical order
* Uses value notation and other .md likeness
* Moves const char *help to top
* Keeps it under 80 chars
* Misc help typos, consistent conjuctioning (i.e return and not returns)
* Uses addReplySubcommandSyntaxError(c) all over
Signed-off-by: Itamar Haber <itamar@redislabs.com>
Diffstat (limited to 'src/object.c')
-rw-r--r-- | src/object.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/object.c b/src/object.c index 583d13737..8573ef0b5 100644 --- a/src/object.c +++ b/src/object.c @@ -1035,7 +1035,7 @@ struct redisMemOverhead *getMemoryOverheadData(void) { mem += dictSize(server.repl_scriptcache_dict) * sizeof(dictEntry) + dictSlots(server.repl_scriptcache_dict) * sizeof(dictEntry*); if (listLength(server.repl_scriptcache_fifo) > 0) { - mem += listLength(server.repl_scriptcache_fifo) * (sizeof(listNode) + + mem += listLength(server.repl_scriptcache_fifo) * (sizeof(listNode) + sdsZmallocSize(listNodeValue(listFirst(server.repl_scriptcache_fifo)))); } mh->lua_caches = mem; @@ -1256,10 +1256,18 @@ void objectCommand(client *c) { if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) { const char *help[] = { -"ENCODING <key> -- Return the kind of internal representation used in order to store the value associated with a key.", -"FREQ <key> -- Return the access frequency index of the key. The returned integer is proportional to the logarithm of the recent access frequency of the key.", -"IDLETIME <key> -- Return the idle time of the key, that is the approximated number of seconds elapsed since the last access to the key.", -"REFCOUNT <key> -- Return the number of references of the value associated with the specified key.", +"ENCODING <key>", +" Return the kind of internal representation used in order to store the value", +" associated with a <key>.", +"FREQ <key>", +" Return the access frequency index of the <key>. The returned integer is", +" proportional to the logarithm of the recent access frequency of the key.", +"IDLETIME <key>", +" Return the idle time of the <key>, that is the approximated number of", +" seconds elapsed since the last access to the key.", +"REFCOUNT <key>", +" Return the number of references of the value associated with the specified", +" <key>.", NULL }; addReplyHelp(c, help); @@ -1303,11 +1311,17 @@ NULL void memoryCommand(client *c) { if (!strcasecmp(c->argv[1]->ptr,"help") && c->argc == 2) { const char *help[] = { -"DOCTOR - Return memory problems reports.", -"MALLOC-STATS -- Return internal statistics report from the memory allocator.", -"PURGE -- Attempt to purge dirty pages for reclamation by the allocator.", -"STATS -- Return information about the memory usage of the server.", -"USAGE <key> [SAMPLES <count>] -- Return memory in bytes used by <key> and its value. Nested values are sampled up to <count> times (default: 5).", +"DOCTOR", +" Return memory problems reports.", +"MALLOC-STATS" +" Return internal statistics report from the memory allocator.", +"PURGE", +" Attempt to purge dirty pages for reclamation by the allocator.", +"STATS", +" Return information about the memory usage of the server.", +"USAGE <key> [SAMPLES <count>]", +" Return memory in bytes used by <key> and its value. Nested values are", +" sampled up to <count> times (default: 5).", NULL }; addReplyHelp(c, help); @@ -1452,6 +1466,6 @@ NULL else addReplyError(c, "Error purging dirty pages"); } else { - addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try MEMORY HELP", (char*)c->argv[1]->ptr); + addReplySubcommandSyntaxError(c); } } |