Commit 43e5ccdf authored by antirez's avatar antirez
Browse files

EXPIRE behaviour changed a bit, a negative TTL or an EXPIREAT with unix time...

EXPIRE behaviour changed a bit, a negative TTL or an EXPIREAT with unix time in the past will now delete the key. It seems saner to me than doing nothing.
parent 802e8373
...@@ -4746,8 +4746,9 @@ static void expireGenericCommand(redisClient *c, robj *key, time_t seconds) { ...@@ -4746,8 +4746,9 @@ static void expireGenericCommand(redisClient *c, robj *key, time_t seconds) {
addReply(c,shared.czero); addReply(c,shared.czero);
return; return;
} }
if (seconds <= 0) { if (seconds < 0) {
addReply(c, shared.czero); if (deleteKey(c->db,key)) server.dirty++;
addReply(c, shared.cone);
return; return;
} else { } else {
time_t when = time(NULL)+seconds; time_t when = time(NULL)+seconds;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment