From: Caleb Clausen Date: 2010-04-17T02:48:15+09:00 Subject: Re: Memoize and GC On 4/13/10, Intransition wrote: > On Apr 13, 1:28 pm, Caleb Clausen wrote: >> That is, FOO would behave mostly like a hash, but unused entries would >> age out after a while. Now if only someone would invent an appropriate >> Cache class. > > Ah, very good thought! An LRUCache would do pretty well here. > > Well then, that leads to me to another project. My implementation of > LRUCache (lrucache gem) kind of sucks in that it only handles max > size, so I am looking for a new one to replace it. Any > recommendations? Last time I went looking for a cache class, I found several written in ruby, but I really needed something that would be super-fast, so it had to be written in c. I did write about half of a ruby hash class in c before giving up.... For most use cases, tho, presumably including this one, a ruby implementation would be fine. Having a customizable age-out policy is the only other nice-to-have I can think of.