EchoVault
EchoVault copied to clipboard
Utilize min heap for keysWithExpiry
Problem:
We currently use heaps for our LFU and LRU eviction rules. We do not use a heap with simple TTL.
In the evictKeysWithExpiredTTL method, the key eviction process is:
- based on sample size, iterate through the
keysWithExpirymap sampleSize times and pseudo random keys to an array - iterate through this array, check if the keys expired, and delete the key This process also has the potential to keep live what should be evicted keys.
Proposed Solution: Utilizing a min heap instead would simplify this process and allow it to scale more efficiently.
I like this idea. If you're interested in implementing this, please go ahead.
no problem, I'll work on this.