lukeed/tmp-cache

items are not pro-actively pruned out as they age

Opened this issue · 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.

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.