I have this function using ttl_cache() from cachetools.func:
ttl_cache()
cachetools.func
import cachetools.func class Test: @cachetools.func.ttl_cache(maxs