It would be straightforward to add methods so that the LRUCache class implements the Mapping (or perhaps even MutableMapping) interface which would make it useful in a wider context. The key missing functionality is __iter__, which seems like a reasonable thing to be able to ask (ie. iterate over everything in the cache to do something); there are some questions around locking that may need to be sorted out (probably want to lock for the duration of the iteration, but that may be awkward, alternative is to copy and iterate on the copy).
It would be straightforward to add methods so that the
LRUCacheclass implements theMapping(or perhaps evenMutableMapping) interface which would make it useful in a wider context. The key missing functionality is__iter__, which seems like a reasonable thing to be able to ask (ie. iterate over everything in the cache to do something); there are some questions around locking that may need to be sorted out (probably want to lock for the duration of the iteration, but that may be awkward, alternative is to copy and iterate on the copy).