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

items are not pro-actively pruned out as they age #3

Open
kirillgroshkov opened this issue May 22, 2019 · 1 comment
Open

items are not pro-actively pruned out as they age #3

kirillgroshkov opened this issue May 22, 2019 · 1 comment

Comments

@kirillgroshkov
Copy link

items are not pro-actively pruned out as they age

I'm thinking about memory leaks in this case if LRU is used on a server and cache key is something time based (e.g "today"). In this scenario old keys (when today has moved to the next day) will never be accessed (neither set or get), so never pruned. How would you solve it?

I see one simple/stupid solution to do like setInterval that does cache.clear() once in a while. But that would clear all items, not only stale.

@tripodsgames
Copy link

items are not pro-actively pruned out as they age

I'm thinking about memory leaks in this case if LRU is used on a server and cache key is something time based (e.g "today"). In this scenario old keys (when today has moved to the next day) will never be accessed (neither set or get), so never pruned. How would you solve it?

I see one simple/stupid solution to do like setInterval that does cache.clear() once in a while. But that would clear all items, not only stale.

Old items get pruned when a new item is added and the capacity is full.

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