MCPcopy Create free account
hub / github.com/F-Stack/f-stack / RM_SetLFU

Function RM_SetLFU

app/redis-6.2.6/src/module.c:8857–8863  ·  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

8855 * the access frequencyonly (must be <= 255).
8856 * returns REDISMODULE_OK if the LFU was updated, REDISMODULE_ERR otherwise. */
8857int RM_SetLFU(RedisModuleKey *key, long long lfu_freq) {
8858 if (!key->value)
8859 return REDISMODULE_ERR;
8860 if (objectSetLRUOrLFU(key->value, lfu_freq, -1, 0, 1))
8861 return REDISMODULE_OK;
8862 return REDISMODULE_ERR;
8863}
8864
8865/* Gets the key access frequency or -1 if the server's eviction policy is not
8866 * LFU based.

Callers

nothing calls this directly

Calls 1

objectSetLRUOrLFUFunction · 0.85

Tested by

no test coverage detected