Sorry for the delay in responding ... On 06/Jul/2009 06:42, Regis wrote: > MapMaker used a j.u.Timer, when put element to map, schedule a new > j.u.TimerTask > according to expiration time. For me, using timer can save the extra > LinkedList, but a little complicated, since it need to start a timer > thread and management of TimerTask is more complicated than LinkedList.
I agree that using a j.u.Timer is too heavyweight for this case. Since we don't care about being too exact on the expiry of items from the cache we can simply charge a 'tax' on each look-up to see if an item is ready to be removed. Anyway, it would be good to put this in and get the speed up. Regards, Tim