mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Move the struct evictionPoolEntry() into only file using it.
Local scope is always better when possible.
This commit is contained in:
parent
d8e92a8207
commit
965905c9f2
21
src/evict.c
21
src/evict.c
@ -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. */
|
||||||
|
13
src/server.h
13
src/server.h
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user