mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 15:21:03 +00:00
Remove useless complexity from MSET implementation.
This commit is contained in:
parent
f30b18f4de
commit
c33ef454f0
@ -301,24 +301,22 @@ void mgetCommand(client *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void msetGenericCommand(client *c, int nx) {
|
void msetGenericCommand(client *c, int nx) {
|
||||||
int j, busykeys = 0;
|
int j;
|
||||||
|
|
||||||
if ((c->argc % 2) == 0) {
|
if ((c->argc % 2) == 0) {
|
||||||
addReplyError(c,"wrong number of arguments for MSET");
|
addReplyError(c,"wrong number of arguments for MSET");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle the NX flag. The MSETNX semantic is to return zero and don't
|
/* Handle the NX flag. The MSETNX semantic is to return zero and don't
|
||||||
* set nothing at all if at least one already key exists. */
|
* set anything if at least one key alerady exists. */
|
||||||
if (nx) {
|
if (nx) {
|
||||||
for (j = 1; j < c->argc; j += 2) {
|
for (j = 1; j < c->argc; j += 2) {
|
||||||
if (lookupKeyWrite(c->db,c->argv[j]) != NULL) {
|
if (lookupKeyWrite(c->db,c->argv[j]) != NULL) {
|
||||||
busykeys++;
|
addReply(c, shared.czero);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (busykeys) {
|
|
||||||
addReply(c, shared.czero);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 1; j < c->argc; j += 2) {
|
for (j = 1; j < c->argc; j += 2) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user