diff --git a/src/t_string.c b/src/t_string.c index 1e29a6133479..ba42796130c7 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -26,7 +26,7 @@ void setGenericCommand(redisClient *c, int nx, robj *key, robj *val, robj *expir if (unit == UNIT_SECONDS) milliseconds *= 1000; } - if (lookupKeyWrite(c->db,key) != NULL && nx) { + if (nx && lookupKeyWrite(c->db,key) != NULL) { addReply(c,shared.czero); return; }