From: Caleb Clausen Date: 2010-04-14T02:28:29+09:00 Subject: Re: Memoize and GC On 4/13/10, Intransition wrote: > will mean that @foo be GC'd when the object is GC'd, but if I do > > FOO = [] > > def foo > FOO[object_id] ||= something > end I have to assume that you meant FOO to be a hash... tho an array will work here... sorta. But rather than either an array or hash, what if you could write: FOO=Cache.new 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.