tmp-cache icon indicating copy to clipboard operation
tmp-cache copied to clipboard

items are not pro-actively pruned out as they age

Open kirillgroshkov opened this issue 6 years ago • 1 comments

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.

kirillgroshkov avatar May 22 '19 08:05 kirillgroshkov

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.

tripodsgames avatar Jun 04 '21 02:06 tripodsgames