Given an object returns the min number of milliseconds the object was never * requested, using an approximated LRU algorithm. */
| 89 | /* Given an object returns the min number of milliseconds the object was never |
| 90 | * requested, using an approximated LRU algorithm. */ |
| 91 | unsigned long long estimateObjectIdleTime(robj *o) { |
| 92 | unsigned long long lruclock = LRU_CLOCK(); |
| 93 | if (lruclock >= o->lru) { |
| 94 | return (lruclock - o->lru) * LRU_CLOCK_RESOLUTION; |
| 95 | } else { |
| 96 | return (lruclock + (LRU_CLOCK_MAX - o->lru)) * |
| 97 | LRU_CLOCK_RESOLUTION; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /* LRU approximation algorithm |
| 102 | * |
no test coverage detected