class documentation

class ACMELRUCache(cachetools.LRUCache):

Constructor: ACMELRUCache(maxsize, getsizeof, evict)

View In Hierarchy

An improved version of the LRUCache from cachetools with an eviction callback.

Method __init__ Initialize the LRUCache.
Method popitem Pop an item from the cache and call the (optional) eviction callback.
Instance Variable _evict The eviction callback function.
def __init__(self, maxsize: int, getsizeof: Callable = None, evict: Callable = None):

Initialize the LRUCache.

Parameters
maxsize:intThe maximum size of the cache.
getsizeof:CallableOptional function to determine the size of an item.
evict:CallableOptional callback function that is called when an item is evicted.
def popitem(self) -> tuple[object, object]:

Pop an item from the cache and call the (optional) eviction callback.

Returns
tuple[object, object]A tuple with the key and the value of the evicted item.
_evict: Callable | None =

The eviction callback function.