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
17f41d49
Commit
17f41d49
authored
Apr 19, 2011
by
antirez
Browse files
variadic SADD backported from unstable
parent
8514f3c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
17f41d49
...
@@ -102,7 +102,7 @@ struct redisCommand readonlyCommandTable[] = {
...
@@ -102,7 +102,7 @@ struct redisCommand readonlyCommandTable[] = {
{
"ltrim"
,
ltrimCommand
,
4
,
0
,
NULL
,
1
,
1
,
1
},
{
"ltrim"
,
ltrimCommand
,
4
,
0
,
NULL
,
1
,
1
,
1
},
{
"lrem"
,
lremCommand
,
4
,
0
,
NULL
,
1
,
1
,
1
},
{
"lrem"
,
lremCommand
,
4
,
0
,
NULL
,
1
,
1
,
1
},
{
"rpoplpush"
,
rpoplpushCommand
,
3
,
REDIS_CMD_DENYOOM
,
NULL
,
1
,
2
,
1
},
{
"rpoplpush"
,
rpoplpushCommand
,
3
,
REDIS_CMD_DENYOOM
,
NULL
,
1
,
2
,
1
},
{
"sadd"
,
saddCommand
,
3
,
REDIS_CMD_DENYOOM
,
NULL
,
1
,
1
,
1
},
{
"sadd"
,
saddCommand
,
-
3
,
REDIS_CMD_DENYOOM
,
NULL
,
1
,
1
,
1
},
{
"srem"
,
sremCommand
,
3
,
0
,
NULL
,
1
,
1
,
1
},
{
"srem"
,
sremCommand
,
3
,
0
,
NULL
,
1
,
1
,
1
},
{
"smove"
,
smoveCommand
,
4
,
0
,
NULL
,
1
,
2
,
1
},
{
"smove"
,
smoveCommand
,
4
,
0
,
NULL
,
1
,
2
,
1
},
{
"sismember"
,
sismemberCommand
,
3
,
0
,
NULL
,
1
,
1
,
1
},
{
"sismember"
,
sismemberCommand
,
3
,
0
,
NULL
,
1
,
1
,
1
},
...
...
src/t_set.c
View file @
17f41d49
...
@@ -218,9 +218,9 @@ void setTypeConvert(robj *setobj, int enc) {
...
@@ -218,9 +218,9 @@ void setTypeConvert(robj *setobj, int enc) {
void
saddCommand
(
redisClient
*
c
)
{
void
saddCommand
(
redisClient
*
c
)
{
robj
*
set
;
robj
*
set
;
int
j
,
added
=
0
;
set
=
lookupKeyWrite
(
c
->
db
,
c
->
argv
[
1
]);
set
=
lookupKeyWrite
(
c
->
db
,
c
->
argv
[
1
]);
c
->
argv
[
2
]
=
tryObjectEncoding
(
c
->
argv
[
2
]);
if
(
set
==
NULL
)
{
if
(
set
==
NULL
)
{
set
=
setTypeCreate
(
c
->
argv
[
2
]);
set
=
setTypeCreate
(
c
->
argv
[
2
]);
dbAdd
(
c
->
db
,
c
->
argv
[
1
],
set
);
dbAdd
(
c
->
db
,
c
->
argv
[
1
],
set
);
...
@@ -230,13 +230,14 @@ void saddCommand(redisClient *c) {
...
@@ -230,13 +230,14 @@ void saddCommand(redisClient *c) {
return
;
return
;
}
}
}
}
if
(
setTypeAdd
(
set
,
c
->
argv
[
2
]))
{
signalModifiedKey
(
c
->
db
,
c
->
argv
[
1
]);
for
(
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
server
.
dirty
++
;
c
->
argv
[
j
]
=
tryObjectEncoding
(
c
->
argv
[
j
]);
addReply
(
c
,
shared
.
cone
);
if
(
setTypeAdd
(
set
,
c
->
argv
[
j
]))
added
++
;
}
else
{
addReply
(
c
,
shared
.
czero
);
}
}
if
(
added
)
touchWatchedKey
(
c
->
db
,
c
->
argv
[
1
]);
server
.
dirty
+=
added
;
addReplyLongLong
(
c
,
added
);
}
}
void
sremCommand
(
redisClient
*
c
)
{
void
sremCommand
(
redisClient
*
c
)
{
...
...
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