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

Function LFUTimeElapsed

src/evict.cpp:301–305  ·  view source on GitHub ↗

Given an object last access time, compute the minimum number of minutes * that elapsed since the last access. Handle overflow (ldt greater than * the current 16 bits minutes time) considering the time as wrapping * exactly once. */

Source from the content-addressed store, hash-verified

299 * the current 16 bits minutes time) considering the time as wrapping
300 * exactly once. */
301unsigned long LFUTimeElapsed(unsigned long ldt) {
302 unsigned long now = LFUGetTimeInMinutes();
303 if (now >= ldt) return now-ldt;
304 return 65535-ldt+now;
305}
306
307/* Logarithmically increment a counter. The greater is the current counter value
308 * the less likely is that it gets really implemented. Saturate it at 255. */

Callers 1

LFUDecrAndReturnFunction · 0.85

Calls 1

LFUGetTimeInMinutesFunction · 0.85

Tested by

no test coverage detected