LRU cache (and other things missing from the standard library ...)

Paul Moore pf_moore at
Thu Nov 4 21:26:29 CET 2004

Gerhard Haering <gh at> writes:

> I recently implemented a LRU cache. And I wondered why such a useful class is
> not already in the standard library. The only thing I found was a cookbook
> entry but the comments said it was problematic.


> I've already started translating it into C (*) , which speeds it up by between
> factor 5 to 8. Maybe a candidate for the standard library once it's finished?

Would this be a suitable addition for the collections module (which
currently only has deque in it)?

I'm not sure if a LRU cache counts as a "collection" in that sense. I
looked at the code briefly, but don't really follow it yet...

One of the lessons of history is that nothing is often a good thing to
do and always a clever thing to say. -- Will Durant

More information about the Python-list mailing list