Skip to content Skip to sidebar Skip to footer

Clear Python Cachetools Manually

In this class I have a method which I cache its result using cachetools: from cachetools import cached, TTLCache class Log: @cached(TTLCache(maxsize=200, ttl=300)) def ge

Solution 1:

You can store the sessions in a variable outside the class:

_sessions_cache = TTLCache(maxsize=200, ttl=300)

and then just call:

_sessions_cache.clear()

Post a Comment for "Clear Python Cachetools Manually"