class documentation
class ACMETTLCache(TTLCache):
Constructor: ACMETTLCache(maxsize, ttl, timer, getsizeof, ...)
An improved TTLCache that supports an eviction callback function.
This callback is called whenever an item is evicted from the cache, either due to expiration or because the cache has reached its maximum size.
| Method | __init__ |
Initialize the LRUCache. |
| Method | expire |
Expire items from the cache and call the (optional) eviction callback for each expired item. |
| Instance Variable | _evict |
The eviction callback function. |
def __init__(self, maxsize:
int, ttl: Any, timer: Callable = time.monotonic, getsizeof: Callable | None = None, evict: Callable | None = None):
¶
Initialize the LRUCache.
| Parameters | |
maxsize:int | The maximum size of the cache. |
ttl:Any | The time-to-live for cache entries. |
timer:Callable | Undocumented |
getsizeof:Callable | None | Optional function to determine the size of an item. |
evict:Callable | None | Optional callback function that is called when an item is evicted. |