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
02d38f6b
Commit
02d38f6b
authored
Nov 24, 2017
by
Itamar Haber
Browse files
Adds `OBJECT help`
parent
b28fb3d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/object.c
View file @
02d38f6b
...
@@ -1012,11 +1012,25 @@ robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply) {
...
@@ -1012,11 +1012,25 @@ robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply) {
}
}
/* Object command allows to inspect the internals of an Redis Object.
/* Object command allows to inspect the internals of an Redis Object.
* Usage: OBJECT <refcount|encoding|idletime> <key> */
* Usage: OBJECT <refcount|encoding|idletime
|freq
> <key> */
void
objectCommand
(
client
*
c
)
{
void
objectCommand
(
client
*
c
)
{
robj
*
o
;
robj
*
o
;
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"refcount"
)
&&
c
->
argc
==
3
)
{
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
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"refcount"
)
&&
c
->
argc
==
3
)
{
if
((
o
=
objectCommandLookupOrReply
(
c
,
c
->
argv
[
2
],
shared
.
nullbulk
))
if
((
o
=
objectCommandLookupOrReply
(
c
,
c
->
argv
[
2
],
shared
.
nullbulk
))
==
NULL
)
return
;
==
NULL
)
return
;
addReplyLongLong
(
c
,
o
->
refcount
);
addReplyLongLong
(
c
,
o
->
refcount
);
...
@@ -1041,7 +1055,8 @@ void objectCommand(client *c) {
...
@@ -1041,7 +1055,8 @@ void objectCommand(client *c) {
}
}
addReplyLongLong
(
c
,
o
->
lru
&
255
);
addReplyLongLong
(
c
,
o
->
lru
&
255
);
}
else
{
}
else
{
addReplyError
(
c
,
"Syntax error. Try OBJECT (refcount|encoding|idletime|freq)"
);
addReplyErrorFormat
(
c
,
"Unknown subcommand or wrong number of arguments for '%s'. Try OBJECT help"
,
(
char
*
)
c
->
argv
[
1
]
->
ptr
);
}
}
}
}
...
...
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