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

Function updateLFU

src/db.cpp:72–76  ·  view source on GitHub ↗

Update LFU when an object is accessed. * Firstly, decrement the counter if the decrement time is reached. * Then logarithmically increment the counter, and update the access time. */

Source from the content-addressed store, hash-verified

70 * Firstly, decrement the counter if the decrement time is reached.
71 * Then logarithmically increment the counter, and update the access time. */
72void updateLFU(robj *val) {
73 unsigned long counter = LFUDecrAndReturn(val);
74 counter = LFULogIncr(counter);
75 val->lru = (LFUGetTimeInMinutes()<<8) | counter;
76}
77
78void updateExpire(redisDb *db, sds key, robj *valOld, robj *valNew)
79{

Callers 1

lookupKeyUpdateObjFunction · 0.85

Calls 3

LFUDecrAndReturnFunction · 0.85
LFULogIncrFunction · 0.85
LFUGetTimeInMinutesFunction · 0.85

Tested by

no test coverage detected