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

Fix LRU to correctly evict cache items when replaced #52

Merged
merged 1 commit into from
Dec 20, 2022

Conversation

mattharr013
Copy link
Contributor

Currently when group.Set is called, if the key already exists in a cache instance, then nbytes is not updated correctly since OnEvicted is not called.

This means the cache slow leaks memory eventually being unable to cache any items.

To fix this, this PR updates the lru cache to call OnEvicted when replacing the value of an existing key.

@mattharr013 mattharr013 marked this pull request as ready for review November 11, 2022 14:11
@matino
Copy link

matino commented Dec 20, 2022

@thrawn01 is there any chance that this can be released?

Copy link
Contributor

@thrawn01 thrawn01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this PR! Sorry for the long wait on this, It's been a very busy holiday season!

@matino LOL, I was just working on this PR when I saw your message show up. That's a first!

@thrawn01 thrawn01 merged commit a139af4 into mailgun:master Dec 20, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants