Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b18c92b9
Commit
b18c92b9
authored
Jun 27, 2014
by
antirez
Browse files
DEBUG CMDKEYS moved to COMMAND GETKEYS.
parent
d3f43db2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
b18c92b9
...
@@ -370,24 +370,6 @@ void debugCommand(redisClient *c) {
...
@@ -370,24 +370,6 @@ void debugCommand(redisClient *c) {
{
{
server
.
active_expire_enabled
=
atoi
(
c
->
argv
[
2
]
->
ptr
);
server
.
active_expire_enabled
=
atoi
(
c
->
argv
[
2
]
->
ptr
);
addReply
(
c
,
shared
.
ok
);
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
;
}
else
if
((
cmd
->
arity
>
0
&&
cmd
->
arity
!=
c
->
argc
-
2
)
||
((
c
->
argc
-
2
)
<
-
cmd
->
arity
))
{
addReplyError
(
c
,
"Invalid number of arguments specified for command"
);
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
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"error"
)
&&
c
->
argc
==
3
)
{
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"error"
)
&&
c
->
argc
==
3
)
{
sds
errstr
=
sdsnewlen
(
"-"
,
1
);
sds
errstr
=
sdsnewlen
(
"-"
,
1
);
...
...
src/redis.c
View file @
b18c92b9
...
@@ -2468,6 +2468,24 @@ void commandCommand(redisClient *c) {
...
@@ -2468,6 +2468,24 @@ void commandCommand(redisClient *c) {
}
}
} else if (!strcasecmp(c->argv[1]->ptr, "count") && c->argc == 2) {
} else if (!strcasecmp(c->argv[1]->ptr, "count") && c->argc == 2) {
addReplyLongLong(c, dictSize(server.commands));
addReplyLongLong(c, dictSize(server.commands));
} else if (!strcasecmp(c->argv[1]->ptr,"getkeys") && c->argc >= 3) {
struct redisCommand *cmd = lookupCommand(c->argv[2]->ptr);
int *keys, numkeys, j;
if (!cmd) {
addReplyErrorFormat(c,"Invalid command specified");
return;
} else if ((cmd->arity > 0 && cmd->arity != c->argc-2) ||
((c->argc-2) < -cmd->arity))
{
addReplyError(c,"Invalid number of arguments specified for command");
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 {
} else {
addReplyError(c, "Unknown subcommand or wrong number of arguments.");
addReplyError(c, "Unknown subcommand or wrong number of arguments.");
return;
return;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment