Salvatore, thanks a lot!
Now it is clear enough. And here is just a couple of little questions:
1) If it is not enough to evict just one key it repeats what you
wrote, right? (select N random keys and chose one of them to evict)
I'm pretty sure it does, but just to make sure.
2) And all of that applies for both volatile-lru and allkeys-lru
policies (and volatile-ttl also), rigth? I'm just interested how it
works because AFAIK most caches implementation stores a queue of keys
and moves the key on top of that when it is accessed in order to
implement LRU algorithm but I read somewhere that Redis instead stores
TTL (or something like that). So how do you choose N random keys from
only volatile keys or all keys depeding on which policy is configured.
That is, in case volatile-lru is configured you just choose N random
keys and check if all of them are volatile and choose a few keys more
if some of the keys are not volatile again and again until N volatile
keys are chosen. Or do you have some smarter logic?
On Jun 3, 7:54 pm, Salvatore Sanfilippo <
anti...@gmail.com> wrote: