tkem/cachetools

How can I get the cache expiration time?

Closed this issue · 1 comments

Imagine a situation that I created a cache with a lifetime.
How can I get the lifetime of the cache.

in docs:
classcachetools.TTLCache(maxsize, ttl, timer=time.monotonic, getsizeof=None)

ttl
The time-to-live value of the cache’s items.get ttl ?

How get ttl ?

tkem commented

Like so:

>>> from cachetools import TTLCache
>>> c = TTLCache(10, 10)
>>> c.ttl
10