valkey-io / valkey-doc

Other
17 stars 25 forks source link

Mention that eviction policies use approximated randomized algorithms #144

Closed enjoy-binbin closed 2 weeks ago

enjoy-binbin commented 2 weeks ago

We clearly indicate in the documentation that LRU / LFU are using approximated randomized algorithms. Some people think volatile-ttl is accurate, i suppose adding this sentence will be helpful, the text is from valkey.conf

enjoy-binbin commented 2 weeks ago

Some people think volatile-ttl is accurate... i suppose adding this sentence will be helpful

In valkey.conf we will mention this

# MAXMEMORY POLICY: how the server will select what to remove when maxmemory
# is reached. You can select one from the following behaviors:
#
# volatile-lru -> Evict using approximated LRU, only keys with an expire set.
# allkeys-lru -> Evict any key using approximated LRU.
# volatile-lfu -> Evict using approximated LFU, only keys with an expire set.
# allkeys-lfu -> Evict any key using approximated LFU.
# volatile-random -> Remove a random key having an expire set.
# allkeys-random -> Remove a random key, any key.
# volatile-ttl -> Remove the key with the nearest expire time (minor TTL)
# noeviction -> Don't evict anything, just return an error on write operations.
#
# LRU means Least Recently Used
# LFU means Least Frequently Used
#
# Both LRU, LFU and volatile-ttl are implemented using approximated
# randomized algorithms.

@zuiderkwast this is a bad title, please fix it (help me polish it).