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
24ecabc9
Commit
24ecabc9
authored
Oct 28, 2013
by
antirez
Browse files
SSCAN implemented.
parent
17785f40
Changes
3
Show whitespace changes
Inline
Side-by-side
src/redis.c
View file @
24ecabc9
...
@@ -162,6 +162,7 @@ struct redisCommand redisCommandTable[] = {
...
@@ -162,6 +162,7 @@ struct redisCommand redisCommandTable[] = {
{
"sdiff"
,
sdiffCommand
,
-
2
,
"rS"
,
0
,
NULL
,
1
,
-
1
,
1
,
0
,
0
},
{
"sdiff"
,
sdiffCommand
,
-
2
,
"rS"
,
0
,
NULL
,
1
,
-
1
,
1
,
0
,
0
},
{
"sdiffstore"
,
sdiffstoreCommand
,
-
3
,
"wm"
,
0
,
NULL
,
1
,
-
1
,
1
,
0
,
0
},
{
"sdiffstore"
,
sdiffstoreCommand
,
-
3
,
"wm"
,
0
,
NULL
,
1
,
-
1
,
1
,
0
,
0
},
{
"smembers"
,
sinterCommand
,
2
,
"rS"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"smembers"
,
sinterCommand
,
2
,
"rS"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"sscan"
,
sscanCommand
,
-
3
,
"rR"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"zadd"
,
zaddCommand
,
-
4
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"zadd"
,
zaddCommand
,
-
4
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"zincrby"
,
zincrbyCommand
,
4
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"zincrby"
,
zincrbyCommand
,
4
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"zrem"
,
zremCommand
,
-
3
,
"w"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"zrem"
,
zremCommand
,
-
3
,
"w"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
...
@@ -1187,6 +1188,7 @@ void createSharedObjects(void) {
...
@@ -1187,6 +1188,7 @@ void createSharedObjects(void) {
shared
.
emptymultibulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"*0
\r\n
"
));
shared
.
emptymultibulk
=
createObject
(
REDIS_STRING
,
sdsnew
(
"*0
\r\n
"
));
shared
.
pong
=
createObject
(
REDIS_STRING
,
sdsnew
(
"+PONG
\r\n
"
));
shared
.
pong
=
createObject
(
REDIS_STRING
,
sdsnew
(
"+PONG
\r\n
"
));
shared
.
queued
=
createObject
(
REDIS_STRING
,
sdsnew
(
"+QUEUED
\r\n
"
));
shared
.
queued
=
createObject
(
REDIS_STRING
,
sdsnew
(
"+QUEUED
\r\n
"
));
shared
.
emptyscan
=
createObject
(
REDIS_STRING
,
sdsnew
(
"*2
\r\n
$1
\r\n
0
\r\n
*0
\r\n
"
));
shared
.
wrongtypeerr
=
createObject
(
REDIS_STRING
,
sdsnew
(
shared
.
wrongtypeerr
=
createObject
(
REDIS_STRING
,
sdsnew
(
"-WRONGTYPE Operation against a key holding the wrong kind of value
\r\n
"
));
"-WRONGTYPE Operation against a key holding the wrong kind of value
\r\n
"
));
shared
.
nokeyerr
=
createObject
(
REDIS_STRING
,
sdsnew
(
shared
.
nokeyerr
=
createObject
(
REDIS_STRING
,
sdsnew
(
...
...
src/redis.h
View file @
24ecabc9
...
@@ -499,7 +499,7 @@ struct sharedObjectsStruct {
...
@@ -499,7 +499,7 @@ struct sharedObjectsStruct {
*
masterdownerr
,
*
roslaveerr
,
*
execaborterr
,
*
noautherr
,
*
noreplicaserr
,
*
masterdownerr
,
*
roslaveerr
,
*
execaborterr
,
*
noautherr
,
*
noreplicaserr
,
*
oomerr
,
*
plus
,
*
messagebulk
,
*
pmessagebulk
,
*
subscribebulk
,
*
oomerr
,
*
plus
,
*
messagebulk
,
*
pmessagebulk
,
*
subscribebulk
,
*
unsubscribebulk
,
*
psubscribebulk
,
*
punsubscribebulk
,
*
del
,
*
rpop
,
*
lpop
,
*
unsubscribebulk
,
*
psubscribebulk
,
*
punsubscribebulk
,
*
del
,
*
rpop
,
*
lpop
,
*
lpush
,
*
lpush
,
*
emptyscan
,
*
select
[
REDIS_SHARED_SELECT_CMDS
],
*
select
[
REDIS_SHARED_SELECT_CMDS
],
*
integers
[
REDIS_SHARED_INTEGERS
],
*
integers
[
REDIS_SHARED_INTEGERS
],
*
mbulkhdr
[
REDIS_SHARED_BULKHDR_LEN
],
/* "*<value>\r\n" */
*
mbulkhdr
[
REDIS_SHARED_BULKHDR_LEN
],
/* "*<value>\r\n" */
...
@@ -1167,6 +1167,7 @@ int selectDb(redisClient *c, int id);
...
@@ -1167,6 +1167,7 @@ int selectDb(redisClient *c, int id);
void
signalModifiedKey
(
redisDb
*
db
,
robj
*
key
);
void
signalModifiedKey
(
redisDb
*
db
,
robj
*
key
);
void
signalFlushedDb
(
int
dbid
);
void
signalFlushedDb
(
int
dbid
);
unsigned
int
GetKeysInSlot
(
unsigned
int
hashslot
,
robj
**
keys
,
unsigned
int
count
);
unsigned
int
GetKeysInSlot
(
unsigned
int
hashslot
,
robj
**
keys
,
unsigned
int
count
);
void
scanGenericCommand
(
redisClient
*
c
,
robj
*
o
);
/* API to get key arguments from commands */
/* API to get key arguments from commands */
#define REDIS_GETKEYS_ALL 0
#define REDIS_GETKEYS_ALL 0
...
@@ -1250,6 +1251,7 @@ void sunionCommand(redisClient *c);
...
@@ -1250,6 +1251,7 @@ void sunionCommand(redisClient *c);
void
sunionstoreCommand
(
redisClient
*
c
);
void
sunionstoreCommand
(
redisClient
*
c
);
void
sdiffCommand
(
redisClient
*
c
);
void
sdiffCommand
(
redisClient
*
c
);
void
sdiffstoreCommand
(
redisClient
*
c
);
void
sdiffstoreCommand
(
redisClient
*
c
);
void
sscanCommand
(
redisClient
*
c
);
void
syncCommand
(
redisClient
*
c
);
void
syncCommand
(
redisClient
*
c
);
void
flushdbCommand
(
redisClient
*
c
);
void
flushdbCommand
(
redisClient
*
c
);
void
flushallCommand
(
redisClient
*
c
);
void
flushallCommand
(
redisClient
*
c
);
...
...
src/t_set.c
View file @
24ecabc9
...
@@ -911,3 +911,11 @@ void sdiffCommand(redisClient *c) {
...
@@ -911,3 +911,11 @@ void sdiffCommand(redisClient *c) {
void
sdiffstoreCommand
(
redisClient
*
c
)
{
void
sdiffstoreCommand
(
redisClient
*
c
)
{
sunionDiffGenericCommand
(
c
,
c
->
argv
+
2
,
c
->
argc
-
2
,
c
->
argv
[
1
],
REDIS_OP_DIFF
);
sunionDiffGenericCommand
(
c
,
c
->
argv
+
2
,
c
->
argc
-
2
,
c
->
argv
[
1
],
REDIS_OP_DIFF
);
}
}
void
sscanCommand
(
redisClient
*
c
)
{
robj
*
set
;
if
((
set
=
lookupKeyReadOrReply
(
c
,
c
->
argv
[
1
],
shared
.
emptyscan
))
==
NULL
||
checkType
(
c
,
set
,
REDIS_SET
))
return
;
scanGenericCommand
(
c
,
set
);
}
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