Module cachetools.cachelru
CacheLRU contains maximum size
items
Eviction policy:
- evict TTL-ed entry (if TTL enabled), otherwise
- if oldest entry not expired - evict oldest accessed (LRU)
User can be informed about evicted entries via cache event list.
Implemented as HashMap and multi-dlist.
HashMap keeps
- cached value.
- pointer to dlist element.
- creation time (to check expiration and purge expired entry on get() without access to dlist).
dlist keep key, creation timestamp (to check expiration)
- key, so that we can remove entries from hashmap for lists heads (AccessIndex and TimeIndex)
- creation time, so that we can check expiration for 'TimeIndex'
Classes
Name | Description |
---|---|
CacheLRU
|