Is there any way of over-riding the lru_cache
in python?
Specifically if I have a function such as:
import functools
@functools.lru_cache(maxsize=None)
def function_of_interest(variables):
...
return(processed_values)
Is is possible to reset the cache, and hence run-run the function?
Is is possible to reset the cache, and hence re-run the function?
If my understanding is correct, you can just use cache_clear
on the decorated function. If you've filled the cache by running it, this clears all indicators for you, that is:
function_of_interest.cache_clear()
Should result in a cache_info
of:
CacheInfo(hits=0, misses=0, maxsize=None, currsize=0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With