LRU cache
Dino
dino at no.spam.ar
Tue Feb 14 17:07:00 EST 2023
Here's my problem today. I am using a dict() to implement a quick and
dirty in-memory cache.
I am stopping adding elements when I am reaching 1000 elements (totally
arbitrary number), but I would like to have something slightly more
sophisticated to free up space for newer and potentially more relevant
entries.
I am thinking of the Least Recently Used principle, but how to implement
that is not immediate. Before I embark on reinventing the wheel, is
there a tool, library or smart trick that will allow me to remove
elements with LRU logic?
thanks
Dino
More information about the Python-list
mailing list