diff options
author | antirez <antirez@gmail.com> | 2016-07-07 15:04:25 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-07-12 12:22:38 +0200 |
commit | 965905c9f22c52abe5413e10a1ea919bb9729c94 (patch) | |
tree | e95ec9841ebe52d78d851c30fe446d65c9bcf05e /src/evict.c | |
parent | d8e92a8207d0bafe133c26067e671b1ab6383079 (diff) | |
download | redis-965905c9f22c52abe5413e10a1ea919bb9729c94.tar.gz |
Move the struct evictionPoolEntry() into only file using it.
Local scope is always better when possible.
Diffstat (limited to 'src/evict.c')
-rw-r--r-- | src/evict.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/evict.c b/src/evict.c index dbec6b4b5..5e08274e4 100644 --- a/src/evict.c +++ b/src/evict.c @@ -33,6 +33,27 @@ #include "server.h" #include "bio.h" +/* ---------------------------------------------------------------------------- + * Data structures + * --------------------------------------------------------------------------*/ + +/* To improve the quality of the LRU approximation we take a set of keys + * that are good candidate for eviction across freeMemoryIfNeeded() calls. + * + * Entries inside the eviciton pool are taken ordered by idle time, putting + * greater idle times to the right (ascending order). + * + * Empty entries have the key pointer set to NULL. */ +#define MAXMEMORY_EVICTION_POOL_SIZE 16 +struct evictionPoolEntry { + unsigned long long idle; /* Object idle time. */ + sds key; /* Key name. */ +}; + +/* ---------------------------------------------------------------------------- + * Implementation of eviction, aging and LRU + * --------------------------------------------------------------------------*/ + /* Return the LRU clock, based on the clock resolution. This is a time * in a reduced-bits format that can be used to set and check the * object->lru field of redisObject structures. */ |