core.cache.instance_cache ========================= .. py:module:: core.cache.instance_cache Attributes ---------- .. autoapisummary:: core.cache.instance_cache._F Functions --------- .. autoapisummary:: core.cache.instance_cache.instance_lru_cache Module Contents --------------- .. py:data:: _F .. py:function:: instance_lru_cache(*, maxsize: int | None = ...) -> collections.abc.Callable[[_F], _F] instance_lru_cache(method: _F, *, maxsize: int | None = ...) -> _F Least-recently-used cache decorator for class methods. The cache follows the lifetime of an object (it is stored on the object, not on the class) and can be used on unhashable objects. This is a wrapper around functools.lru_cache which prevents memory leaks when using LRU cache within classes. https://stackoverflow.com/a/71663059