diff options
author | antirez <antirez@gmail.com> | 2016-07-15 12:12:52 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-07-15 12:12:58 +0200 |
commit | 5d07984c5d48d6253ea5884d69da3f06cdc90f1b (patch) | |
tree | c69a4d5043e308dbcf5b8509d2ddc86b85cbcd16 /src/db.c | |
parent | ada70c7c532f8a1d1fe946dd7663c9e48d834a02 (diff) | |
download | redis-5d07984c5d48d6253ea5884d69da3f06cdc90f1b.tar.gz |
LFU: Redis object level implementation.
Implementation of LFU maxmemory policy for anything related to Redis
objects. Still no actual eviction implemented.
Diffstat (limited to 'src/db.c')
-rw-r--r-- | src/db.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -53,7 +53,13 @@ robj *lookupKey(redisDb *db, robj *key, int flags) { server.aof_child_pid == -1 && !(flags & LOOKUP_NOTOUCH)) { - val->lru = LRU_CLOCK(); + if (server.maxmemory_policy & MAXMEMORY_FLAG_LFU) { + unsigned long ldt = val->lru >> 8; + unsigned long counter = LFULogIncr(val->lru & 255); + val->lru = (ldt << 8) | counter; + } else { + val->lru = LRU_CLOCK(); + } } return val; } else { |