Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
80e129d9
Commit
80e129d9
authored
Dec 10, 2017
by
Itamar Haber
Committed by
antirez
Nov 07, 2018
Browse files
Standardizes `MEMORY HELP` subcommand
parent
88805cbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/object.c
View file @
80e129d9
...
@@ -1287,7 +1287,18 @@ NULL
...
@@ -1287,7 +1287,18 @@ NULL
void
memoryCommand
(
client
*
c
)
{
void
memoryCommand
(
client
*
c
)
{
robj
*
o
;
robj
*
o
;
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"usage"
)
&&
c
->
argc
>=
3
)
{
if
(
c
->
argc
==
2
&&
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"help"
))
{
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)."
,
NULL
};
addReplyHelp
(
c
,
help
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"usage"
)
&&
c
->
argc
>=
3
)
{
long
long
samples
=
OBJ_COMPUTE_SIZE_DEF_SAMPLES
;
long
long
samples
=
OBJ_COMPUTE_SIZE_DEF_SAMPLES
;
for
(
int
j
=
3
;
j
<
c
->
argc
;
j
++
)
{
for
(
int
j
=
3
;
j
<
c
->
argc
;
j
++
)
{
if
(
!
strcasecmp
(
c
->
argv
[
j
]
->
ptr
,
"samples"
)
&&
if
(
!
strcasecmp
(
c
->
argv
[
j
]
->
ptr
,
"samples"
)
&&
...
@@ -1434,19 +1445,7 @@ void memoryCommand(client *c) {
...
@@ -1434,19 +1445,7 @@ void memoryCommand(client *c) {
addReply
(
c
,
shared
.
ok
);
addReply
(
c
,
shared
.
ok
);
/* Nothing to do for other allocators. */
/* Nothing to do for other allocators. */
#endif
#endif
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"help"
)
&&
c
->
argc
==
2
)
{
addReplyMultiBulkLen
(
c
,
5
);
addReplyBulkCString
(
c
,
"MEMORY DOCTOR - Outputs memory problems report"
);
addReplyBulkCString
(
c
,
"MEMORY USAGE <key> [SAMPLES <count>] - Estimate memory usage of key"
);
addReplyBulkCString
(
c
,
"MEMORY STATS - Show memory usage details"
);
addReplyBulkCString
(
c
,
"MEMORY PURGE - Ask the allocator to release memory"
);
addReplyBulkCString
(
c
,
"MEMORY MALLOC-STATS - Show allocator internal stats"
);
}
else
{
}
else
{
addReplyError
(
c
,
"Syntax error. Try MEMORY HELP"
);
addReplyError
Format
(
c
,
"Unknown subcommand or wrong number of arguments for '%s'. Try MEMORY 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