MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / estimateObjectIdleTime

Function estimateObjectIdleTime

src/evict.cpp:93–101  ·  view source on GitHub ↗

Given an object returns the min number of milliseconds the object was never * requested, using an approximated LRU algorithm. */

Source from the content-addressed store, hash-verified

91/* Given an object returns the min number of milliseconds the object was never
92 * requested, using an approximated LRU algorithm. */
93unsigned long long estimateObjectIdleTime(robj_roptr o) {
94 unsigned long long lruclock = LRU_CLOCK();
95 if (lruclock >= o->lru) {
96 return (lruclock - o->lru) * LRU_CLOCK_RESOLUTION;
97 } else {
98 return (lruclock + (LRU_CLOCK_MAX - o->lru)) *
99 LRU_CLOCK_RESOLUTION;
100 }
101}
102
103unsigned long long getIdle(robj *obj, const expireEntry *e) {
104 unsigned long long idle;

Callers 5

getIdleFunction · 0.85
rdbSaveKeyValuePairFunction · 0.85
objectCommandFunction · 0.85
debugCommandFunction · 0.85
RM_GetLRUFunction · 0.85

Calls 1

LRU_CLOCKFunction · 0.85

Tested by

no test coverage detected