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

Function LRU_CLOCK

src/evict.cpp:81–89  ·  view source on GitHub ↗

This function is used to obtain the current LRU clock. * If the current resolution is lower than the frequency we refresh the * LRU clock (as it should be in production servers) we return the * precomputed value, otherwise we need to resort to a system call. */

Source from the content-addressed store, hash-verified

79 * LRU clock (as it should be in production servers) we return the
80 * precomputed value, otherwise we need to resort to a system call. */
81unsigned int LRU_CLOCK(void) {
82 unsigned int lruclock;
83 if (1000/g_pserver->hz <= LRU_CLOCK_RESOLUTION) {
84 lruclock = g_pserver->lruclock;
85 } else {
86 lruclock = getLRUClock();
87 }
88 return lruclock;
89}
90
91/* Given an object returns the min number of milliseconds the object was never
92 * requested, using an approximated LRU algorithm. */

Callers 7

lookupKeyUpdateObjFunction · 0.85
restoreCommandFunction · 0.85
estimateObjectIdleTimeFunction · 0.85
rdbLoadRioFunction · 0.85
createObjectFunction · 0.85
RM_SetLRUFunction · 0.85

Calls 1

getLRUClockFunction · 0.85

Tested by

no test coverage detected