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
a3f9eec2
Commit
a3f9eec2
authored
Mar 01, 2010
by
antirez
Browse files
KEYS now returns a multi bulk reply
parent
18b6cb76
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
a3f9eec2
...
...
@@ -3820,7 +3820,7 @@ static void keysCommand(redisClient *c) {
dictEntry
*
de
;
sds
pattern
=
c
->
argv
[
1
]
->
ptr
;
int
plen
=
sdslen
(
pattern
);
unsigned
long
numkeys
=
0
,
keyslen
=
0
;
unsigned
long
numkeys
=
0
;
robj
*
lenobj
=
createObject
(
REDIS_STRING
,
NULL
);
di
=
dictGetIterator
(
c
->
db
->
dict
);
...
...
@@ -3833,17 +3833,15 @@ static void keysCommand(redisClient *c) {
if
((
pattern
[
0
]
==
'*'
&&
pattern
[
1
]
==
'\0'
)
||
stringmatchlen
(
pattern
,
plen
,
key
,
sdslen
(
key
),
0
))
{
if
(
expireIfNeeded
(
c
->
db
,
keyobj
)
==
0
)
{
if
(
numkeys
!=
0
)
addReply
(
c
,
shared
.
space
);
addReplyBulkLen
(
c
,
keyobj
);
addReply
(
c
,
keyobj
);
addReply
(
c
,
shared
.
crlf
);
numkeys
++
;
keyslen
+=
sdslen
(
key
);
}
}
}
dictReleaseIterator
(
di
);
lenobj
->
ptr
=
sdscatprintf
(
sdsempty
(),
"$%lu
\r\n
"
,
keyslen
+
(
numkeys
?
(
numkeys
-
1
)
:
0
));
addReply
(
c
,
shared
.
crlf
);
lenobj
->
ptr
=
sdscatprintf
(
sdsempty
(),
"*%lu
\r\n
"
,
numkeys
);
}
static
void
dbsizeCommand
(
redisClient
*
c
)
{
...
...
test-redis.tcl
View file @
a3f9eec2
...
...
@@ -178,7 +178,7 @@ proc createComplexDataset {r ops} {
}
proc datasetDigest r
{
set keys
[
lsort
[
split
[
$r
keys *
]
" "
]
]
set keys
[
lsort
[
$r
keys *
]]
set digest
{}
foreach k $keys
{
set t
[
$r
type $k
]
...
...
@@ -204,7 +204,7 @@ proc datasetDigest r {
set aux
[
::sha1::sha1 -hex
[
$r
zrange $k 0 -1
]]
}
}
default
{
error
"Type not supported"
error
"Type not supported
:
$t
"
}
}
if
{
$aux
eq
{}}
continue
...
...
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