Path: csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Caching with timed expiry Date: Mon, 14 May 2012 23:47:17 +0200 Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net UasJVwxFUuQ7sE3Q3my8bwvHz/7ZWVcJ6zdMn0rtnCbTUjjdYBz+50houQCF672fI= Cancel-Lock: sha1:9IF3YewKVYJBw2Vf5YIxF9HYiwY= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:14506 On 09.05.2012 23:43, Roedy Green wrote: > On Tue, 08 May 2012 23:48:48 +0200, Sebastian > wrote, quoted or indirectly quoted > someone who said : >> does anyone of a cache / map implementation in which entries >> expire after a fixed time? By which I mean that after a cnfigurable >> delay after an enzry has been caches,it is automatically removed >>from the cache and some clean-up action (perhaps event-triggred) >> can be taken. > You might want to look into weak links. > http://mindprod.com/jgloss/weak.html That does not give you control of the timing. In theory a SoftReference might be better because GC is more reluctant to clear it. But it's not entirely clear whether they actually behave differently in practice and you still do not get control of timing. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/