Move the struct evictionPoolEntry() into only file using it.

Local scope is always better when possible.
This commit is contained in:
antirez 2016-07-07 15:04:25 +02:00
parent d8e92a8207
commit 965905c9f2
2 changed files with 22 additions and 12 deletions

View File

@ -33,6 +33,27 @@
#include "server.h" #include "server.h"
#include "bio.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 /* 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 * in a reduced-bits format that can be used to set and check the
* object->lru field of redisObject structures. */ * object->lru field of redisObject structures. */

View File

@ -550,18 +550,7 @@ typedef struct redisObject {
_var.ptr = _ptr; \ _var.ptr = _ptr; \
} while(0) } while(0)
/* To improve the quality of the LRU approximation we take a set of keys struct evictionPoolEntry; /* Defined in evict.c */
* 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. */
};
/* Redis database representation. There are multiple databases identified /* Redis database representation. There are multiple databases identified
* by integers from 0 (the default database) up to the max configured * by integers from 0 (the default database) up to the max configured