1
0
mirror of https://github.com/fluencelabs/redis synced 2025-04-02 07:41:04 +00:00

Remove useless complexity from MSET implementation.

This commit is contained in:
antirez 2018-10-22 12:24:02 +02:00
parent f30b18f4de
commit c33ef454f0

@ -301,25 +301,23 @@ void mgetCommand(client *c) {
}
void msetGenericCommand(client *c, int nx) {
int j, busykeys = 0;
int j;
if ((c->argc % 2) == 0) {
addReplyError(c,"wrong number of arguments for MSET");
return;
}
/* 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) {
for (j = 1; j < c->argc; j += 2) {
if (lookupKeyWrite(c->db,c->argv[j]) != NULL) {
busykeys++;
}
}
if (busykeys) {
addReply(c, shared.czero);
return;
}
}
}
for (j = 1; j < c->argc; j += 2) {
c->argv[j+1] = tryObjectEncoding(c->argv[j+1]);