EchoVault icon indicating copy to clipboard operation
EchoVault copied to clipboard

Utilize min heap for keysWithExpiry

Open osteensco opened this issue 1 year ago • 2 comments

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 keysWithExpiry map 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.

osteensco avatar Nov 22 '24 04:11 osteensco

I like this idea. If you're interested in implementing this, please go ahead.

kelvinmwinuka avatar Nov 22 '24 08:11 kelvinmwinuka

no problem, I'll work on this.

osteensco avatar Nov 22 '24 16:11 osteensco