from functools import lru_cache
# store a maximum of 32 value cached
@lru_cache(maxsize=32)
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2)
#clear cache
fib.cache_clear()
from functools import lru_cache
@lru_cache
def some_func(a):
pass