implemented different algorithms for maxmemory

This commit is contained in:
antirez
2010-10-14 21:22:21 +02:00
parent ef59a8bc9e
commit 165346ca29
5 changed files with 175 additions and 7 deletions

View File

@ -443,8 +443,9 @@ char *strEncoding(int encoding) {
* requested, using an approximated LRU algorithm. */
unsigned long estimateObjectIdleTime(robj *o) {
if (server.lruclock >= o->lru) {
return (server.lruclock - o->lru) * 60;
return (server.lruclock - o->lru) * REDIS_LRU_CLOCK_RESOLUTION;
} else {
return ((REDIS_LRU_CLOCK_MAX - o->lru) + server.lruclock) * 60;
return ((REDIS_LRU_CLOCK_MAX - o->lru) + server.lruclock) *
REDIS_LRU_CLOCK_RESOLUTION;
}
}