Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention that eviction policies use approximated randomized algorithms #144

Merged
merged 2 commits into from
Jun 17, 2024

Conversation

enjoy-binbin
Copy link
Member

@enjoy-binbin enjoy-binbin commented Jun 17, 2024

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

…domized algorithms

Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin
Copy link
Member Author

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).

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good.

Why is the title bad? Too long?

Shorter idea: "Mention that eviction policies use approximated randomized algorithms"

I think the word "both" means "each of the two", but here we are talking about three things.

topics/lru-cache.md Outdated Show resolved Hide resolved
Signed-off-by: Binbin <binloveplay1314@qq.com>

Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
@enjoy-binbin enjoy-binbin changed the title Both LRU, LFU and volatile-ttl are implemented using approximated randomized algorithms Mention that eviction policies use approximated randomized algorithms Jun 17, 2024
@enjoy-binbin enjoy-binbin merged commit a18bd47 into valkey-io:main Jun 17, 2024
2 checks passed
@enjoy-binbin enjoy-binbin deleted the volatile-ttl branch June 17, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants