tkem/cachetools

TTLCache without max size

Closed this issue · 2 comments

I noticed that I usually don't care about cache size (number of items), but only care about time of their life when I use TTLCache. Is there a way to disable size limits? Currently I see only workaround with passing math.inf into maxsize arg.

I'm talking about the same issue as described and solved in #113, but for TTLCache object, not for decorators.

tkem commented

As stated quite prominently in the docs

For the purpose of this module, a cache is a mutable mapping of a fixed maximum size.
Setting maxsize to math.inf is the closest you'll get with cachetools, however I've seen other implementations of an "expiring dict" which may be fitting your needs.