@isagalaev you don't need another library! From the docs for lru_cache: https://docs.python.org/3/library/functools.html#functools.lru_cache
> The original underlying function is accessible through the __wrapped__ attribute. This is useful for introspection, for bypassing the cache
So you can easily do something along the lines of:
try:
cached_func.__wrapped__(*args)
except SomeSpecificError:
cached_func(*args)