A least-recently-used cache.
This class caches objects, based on keys. The cache has a fixed size, in number of objects. When a new object is added to the cache, the least recently used old object is dropped. Each object is associated with a key, and use is defined as retrieval of the object using the key.
Two hooks are provided for: for removing an object by user request, and when it is automatically removed due to cache overflow. Either hook is called with the key and object as arguments.
Add new item to cache.
Retrieve item from cache.
Return object associated with key, or None.
List keys for objects in cache.
Remove an item from the cache.
Return True if item was in cache, False otherwise.
Remove oldest object.
Return key and object.