Gets the key access frequency or -1 if the server's eviction policy is not * LFU based. * returns REDISMODULE_OK if when key is valid. */
| 9066 | * LFU based. |
| 9067 | * returns REDISMODULE_OK if when key is valid. */ |
| 9068 | int RM_GetLFU(RedisModuleKey *key, long long *lfu_freq) { |
| 9069 | *lfu_freq = -1; |
| 9070 | if (!key->value) |
| 9071 | return REDISMODULE_ERR; |
| 9072 | if (g_pserver->maxmemory_policy & MAXMEMORY_FLAG_LFU) |
| 9073 | { |
| 9074 | *lfu_freq = LFUDecrAndReturn(key->value); |
| 9075 | } |
| 9076 | return REDISMODULE_OK; |
| 9077 | } |
| 9078 | |
| 9079 | /* -------------------------------------------------------------------------- |
| 9080 | * ## Miscellaneous APIs |
nothing calls this directly
no test coverage detected