diff --git a/src/redis.c b/src/redis.c index fe656de9b0c941565980dd0cc32aa99b0431fd8b..cf5673a3aa4ce7e9276ba4feffe98e1c93c3edee 100644 --- a/src/redis.c +++ b/src/redis.c @@ -1372,6 +1372,10 @@ void freeMemoryIfNeeded(void) { de = dictGetRandomKey(dict); thiskey = dictGetEntryKey(de); + /* When policy is volatile-lru we need an additonal lookup + * to locate the real key, as dict is set to db->expires. */ + if (server.maxmemory_policy == REDIS_MAXMEMORY_VOLATILE_LRU) + de = dictFind(db->dict, thiskey); o = dictGetEntryVal(de); thisval = estimateObjectIdleTime(o);