From a18bd477878bb2db660b6d9445ba0b334a4870c7 Mon Sep 17 00:00:00 2001 From: Binbin Date: Mon, 17 Jun 2024 18:28:45 +0800 Subject: [PATCH] Mention that eviction policies use approximated randomized algorithms (#144) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Binbin Co-authored-by: Viktor Söderqvist --- topics/lru-cache.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/topics/lru-cache.md b/topics/lru-cache.md index fccec2ba..5468ca46 100644 --- a/topics/lru-cache.md +++ b/topics/lru-cache.md @@ -57,6 +57,8 @@ The following policies are available: The policies **volatile-lru**, **volatile-lfu**, **volatile-random**, and **volatile-ttl** behave like **noeviction** if there are no keys to evict matching the prerequisites. +**LRU**, **LFU** and **volatile-ttl** are implemented using approximated randomized algorithms. + Picking the right eviction policy is important depending on the access pattern of your application, however you can reconfigure the policy at runtime while the application is running, and monitor the number of cache misses and hits