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

Utilize min heap for keysWithExpiry #151

Open
osteensco opened this issue Nov 22, 2024 · 2 comments
Open

Utilize min heap for keysWithExpiry #151

osteensco opened this issue Nov 22, 2024 · 2 comments

Comments

@osteensco
Copy link
Contributor

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.

@kelvinmwinuka
Copy link
Collaborator

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

@osteensco
Copy link
Contributor Author

no problem, I'll work on this.

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

No branches or pull requests

2 participants