Skip to main content

isolate_lru_cache

Clear the cache of an LRU cache object on entering and exiting.

def isolate_lru_cache(
lru_cache_object: functools._lru_cache_wrapper
) - > contextmanager

Clear the cache of an LRU cache object on entering and exiting.

Parameters

NameTypeDescription
lru_cache_objectfunctools._lru_cache_wrapperThe LRU cache-decorated function whose cache should be cleared before and after the context block.

Returns

TypeDescription
contextmanagerA context manager that ensures the cache is empty during the execution of the wrapped block.