From: antirez Date: Thu, 29 Oct 2009 23:21:04 +0000 (+0100) Subject: EXPIRE behaviour changed a bit, a negative TTL or an EXPIREAT with unix time in the... X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/43e5ccdf57e2144a8a43c04c5a64e91a155a78fb 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. --- diff --git a/redis.c b/redis.c index 86a06af1..0040483a 100644 --- a/redis.c +++ b/redis.c @@ -4746,8 +4746,9 @@ static void expireGenericCommand(redisClient *c, robj *key, time_t seconds) { addReply(c,shared.czero); return; } - if (seconds <= 0) { - addReply(c, shared.czero); + if (seconds < 0) { + if (deleteKey(c->db,key)) server.dirty++; + addReply(c, shared.cone); return; } else { time_t when = time(NULL)+seconds;