Expiring cached data?

andrew cooke andrew at acooke.org
Sun Nov 2 22:58:41 EST 2003



I have a Haskell program that caches data in a tree.  Unfortunately, the
tree grows to exceed the available memory over time.  In a different
language, where I might be handling the caching myself, rather than
relying on laziness within the language, I might work round this by
keeping track of which leaves in the tree were more recently used, and,
when memory run slow, deleting those that have not been used for some time
(by the nature of the problem, access to particular caches tend to be
grouped, so a long-unused cache can be deleted without much performance
penalty).

What options do I have in Haskell?  I'm interested both in general
solutions (maybe some compilers do this anyway?) and in approaches to
structuring the program so that I can control caching in more detail.

Thanks,
Andrew

-- 
http://www.acooke.org/andrew


More information about the Haskell mailing list