diff --git a/src/evict.c b/src/evict.c index dbec6b4b..5e08274e 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. */ diff --git a/src/server.h b/src/server.h index 4faa9de7..b7e9f54f 100644 --- a/src/server.h +++ b/src/server.h @@ -550,18 +550,7 @@ typedef struct redisObject { _var.ptr = _ptr; \ } while(0) -/* 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. */ -}; +struct evictionPoolEntry; /* Defined in evict.c */ /* Redis database representation. There are multiple databases identified * by integers from 0 (the default database) up to the max configured