diff options
Diffstat (limited to 'src/object.c')
-rw-r--r-- | src/object.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/object.c b/src/object.c index e62b5b3d9..2b9403a49 100644 --- a/src/object.c +++ b/src/object.c @@ -1016,20 +1016,15 @@ robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply) { void objectCommand(client *c) { robj *o; - if (!strcasecmp(c->argv[1]->ptr,"help") && c->argc == 2) { - void *blenp = addDeferredMultiBulkLength(c); - int blen = 0; - blen++; addReplyStatus(c, - "OBJECT <subcommand> key. Subcommands:"); - blen++; addReplyStatus(c, - "refcount -- Return the number of references of the value associated with the specified key."); - blen++; addReplyStatus(c, - "encoding -- Return the kind of internal representation used in order to store the value associated with a key."); - blen++; addReplyStatus(c, - "idletime -- Return the number of seconds since the object stored at the specified key is idle."); - blen++; addReplyStatus(c, - "freq -- Return the inverse logarithmic access frequency counter of the object stored at the specified key."); - setDeferredMultiBulkLength(c,blenp,blen); + 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.", + NULL + }; + addReplyHelp(c, help); } else if (!strcasecmp(c->argv[1]->ptr,"refcount") && c->argc == 3) { if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk)) == NULL) return; @@ -1057,6 +1052,7 @@ void objectCommand(client *c) { } else { addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try OBJECT help", (char *)c->argv[1]->ptr); + return; } } |