mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
DEBUG CMDKEYS added for getKeysFromCommand() testing.
Examples: redis 127.0.0.1:6379> debug cmdkeys set foo bar 1) "foo" redis 127.0.0.1:6379> debug cmdkeys mget a b c 1) "a" 2) "b" 3) "c" redis 127.0.0.1:6379> debug cmdkeys zunionstore foo 2 a b 1) "a" 2) "b" 3) "foo" redis 127.0.0.1:6379> debug cmdkeys ping (empty list or set)
This commit is contained in:
parent
3e1d772677
commit
c4ef1d6494
12
src/debug.c
12
src/debug.c
@ -363,6 +363,18 @@ void debugCommand(redisClient *c) {
|
||||
{
|
||||
server.active_expire_enabled = atoi(c->argv[2]->ptr);
|
||||
addReply(c,shared.ok);
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"cmdkeys") && c->argc >= 3) {
|
||||
struct redisCommand *cmd = lookupCommand(c->argv[2]->ptr);
|
||||
int *keys, numkeys, j;
|
||||
|
||||
if (!cmd) {
|
||||
addReplyError(c,"Invalid command specified");
|
||||
return;
|
||||
}
|
||||
keys = getKeysFromCommand(cmd,c->argv+2,c->argc-2,&numkeys);
|
||||
addReplyMultiBulkLen(c,numkeys);
|
||||
for (j = 0; j < numkeys; j++) addReplyBulk(c,c->argv[keys[j]+2]);
|
||||
getKeysFreeResult(keys);
|
||||
} else {
|
||||
addReplyErrorFormat(c, "Unknown DEBUG subcommand or wrong number of arguments for '%s'",
|
||||
(char*)c->argv[1]->ptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user