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
906573e7
Commit
906573e7
authored
Dec 06, 2009
by
antirez
Browse files
SETNX and MSETNX now respect the delete-on-write operation of EXPIREing keys
parent
71c54b21
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
906573e7
...
...
@@ -2978,6 +2978,7 @@ static void echoCommand(redisClient *c) {
static void setGenericCommand(redisClient *c, int nx) {
int retval;
lookupKeyWrite(c->db,c->argv[1]);
retval = dictAdd(c->db->dict,c->argv[1],c->argv[2]);
if (retval == DICT_ERR) {
if (!nx) {
...
...
@@ -3053,7 +3054,7 @@ static void mgetCommand(redisClient *c) {
}
static void msetGenericCommand(redisClient *c, int nx) {
int j;
int j
, busykeys = 0
;
if ((c->argc % 2) == 0) {
addReplySds(c,sdsnew("-ERR wrong number of arguments\r\n"));
...
...
@@ -3063,12 +3064,15 @@ static void msetGenericCommand(redisClient *c, int nx) {
* set nothing at all if at least one already key exists. */
if (nx) {
for (j = 1; j < c->argc; j += 2) {
if (dictFind(c->db->dict,c->argv[j]) != NULL) {
addReply(c, shared.czero);
return;
if (lookupKeyWrite(c->db,c->argv[j]) != NULL) {
busykeys++;
}
}
}
if (busykeys) {
addReply(c, shared.czero);
return;
}
for (j = 1; j < c->argc; j += 2) {
int retval;
...
...
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