views:

85

answers:

1

I'm looking to implement a disk based caching system. The idea is to allocate a certain amount of disk space and save however much data fits in there, discarding of old files as I run out of space.

LRU is my first choice of deletion strategy, but I'm willing to settle for FIFO. When googling for cache algorithms, the discussion seems to be dominated by memory-based caching. Memcached, for example, would be exactly what I'm looking for, except that it's memory based. On the other hand, solutions like Memcachedb, couchdb etc. don't seem to have LRU capabilities.

The closest thing I've found is the squid proxy server storage systems. COSS seems to be the most documented one, but to use it I would probably have to rewrite it as a stand-alone process (or library).

What project or (java/python) library can I use for such a thing?

EDIT: found this related question.

+1  A: 

I guess all Memory caching library have an option to persist or expand on disk. At least, EHCache does.

So you can just configure a cache library to write on disk (either because you want the data to be persistant, or to expand the cache size over your memory limits).

Note that EhCache has LRU capabilities.

KLE