File cache for images

Дамјан Георгиевски me at here.there.nowhere
Mon Sep 20 18:25:57 CEST 2004

> I'm looking for a way to cache some modified images as files (in a python
> program ofcourse). The scenario would look like this:
> getmodifiedimage(filename):
>    is it in cache?
>    is the cache up to date (not older than file)
>    if not, modify filename and store in cache (keyed by filename +
> modification)
>    return modified image
> I'm looking for prior-art before inventing it myself :)

I've read Fredrik Lundh answer on Google Groups, since it didn't appear on
my news server.

>> I'm not sure what "modify filename" means

I dont want to cache file in memory (a dict in your ex.), access to the file
is cheap. I want to modify the image (say create a thumbnail, or watermark
it) and cache the thumbnail in a file.

... but anyway it should be easy to implement really... It's just I've had a
fealing I miss something... well maybe I miss the implementation of
removing least recently used files in the cache, when the cache becomes
full (as configured).


                   Press every key to continue.

More information about the Python-list mailing list