summaryrefslogtreecommitdiff
path: root/src/db.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-03-20 11:47:12 +0100
committerantirez <antirez@gmail.com>2014-03-20 11:47:12 +0100
commitad6b0f70b27712879c6435cb58edc5bff259f7a8 (patch)
tree38b4089bc0bbd487f0f790f6e68064112ddaf6cb /src/db.c
parent1faf82663ff44d309a7a28989c1d99c8addf971c (diff)
downloadredis-ad6b0f70b27712879c6435cb58edc5bff259f7a8.tar.gz
Obtain LRU clock in a resolution dependent way.
For testing purposes it is handy to have a very high resolution of the LRU clock, so that it is possible to experiment with scripts running in just a few seconds how the eviction algorithms works. This commit allows Redis to use the cached LRU clock, or a value computed on demand, depending on the resolution. So normally we have the good performance of a precomputed value, and a clock that wraps in many days using the normal resolution, but if needed, changing a define will switch behavior to an high resolution LRU clock.
Diffstat (limited to 'src/db.c')
-rw-r--r--src/db.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/db.c b/src/db.c
index 950ebe4fc..090d469d1 100644
--- a/src/db.c
+++ b/src/db.c
@@ -50,7 +50,7 @@ robj *lookupKey(redisDb *db, robj *key) {
* Don't do it if we have a saving child, as this will trigger
* a copy on write madness. */
if (server.rdb_child_pid == -1 && server.aof_child_pid == -1)
- val->lru = server.lruclock;
+ val->lru = LRU_CLOCK();
return val;
} else {
return NULL;