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

Function RM_SetLFU

src/module.cpp:9057–9063  ·  view source on GitHub ↗

Set the key access frequency. only relevant if the server's maxmemory policy * is LFU based. * The frequency is a logarithmic counter that provides an indication of * the access frequencyonly (must be <= 255). * returns REDISMODULE_OK if the LFU was updated, REDISMODULE_ERR otherwise. */

Source from the content-addressed store, hash-verified

9055 * the access frequencyonly (must be <= 255).
9056 * returns REDISMODULE_OK if the LFU was updated, REDISMODULE_ERR otherwise. */
9057int RM_SetLFU(RedisModuleKey *key, long long lfu_freq) {
9058 if (!key->value)
9059 return REDISMODULE_ERR;
9060 if (objectSetLRUOrLFU(key->value, lfu_freq, -1, 0, 1))
9061 return REDISMODULE_OK;
9062 return REDISMODULE_ERR;
9063}
9064
9065/* Gets the key access frequency or -1 if the server's eviction policy is not
9066 * LFU based.

Callers

nothing calls this directly

Calls 1

objectSetLRUOrLFUFunction · 0.85

Tested by

no test coverage detected