From aaac257147acbb40e96c8d8be5c8d1aa249e5393 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 4 May 2015 12:01:39 +0200 Subject: [PATCH] Use cached time in expireCommand() Should not be an issue given that the precision is the second here, at least if we are using a decent HZ value and the cached time refreshes enough times. So the cached time is only used if HZ is >= 10. --- src/db.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/db.c b/src/db.c index 2b8acf85..61975179 100644 --- a/src/db.c +++ b/src/db.c @@ -912,7 +912,8 @@ void expireGenericCommand(redisClient *c, long long basetime, int unit) { } void expireCommand(redisClient *c) { - expireGenericCommand(c,mstime(),UNIT_SECONDS); + long long now = server.hz >= 10 ? server.mstime: mstime(); + expireGenericCommand(c,now,UNIT_SECONDS); } void expireatCommand(redisClient *c) {