Hi Alex,

>> 
>> - drops the oldest value objects,
>> - drops the ones with the longest interim since the last hit
>> - drops the ones with the fewest number of total hits

>This seems interesting. Why should you use one or the other? Would you,
>e.g., use the first type to save computations? (At first sight, there
>shouldn't make too much of a difference, but perhaps the way of sorting
>the objects does.)

Actually I would generally like to have some kind of mixed strategy between
longest interim and fewest number of total hits which should to some degree
be configurable. I need this for a content management system where the page
generation is computation intensive, and I am not too sure yet which caching
strategy would be the best fit, so if I can configure it I can still play
around with the settings during load testing. My problem is that my
implementation for the longest interim is quite inefficient (I keep the keys
in a LinkedList where they are  (re)inserted at the first position on
access, the times I profiled for this  (esp. linkedList.remove()) makes me
doubt that my approach is smashing so far...). Dropping the oldest value
object is straightforward and fast as I do never need to reorder the keys.
Better approaches on this are more than welcome!


>This I do not understand. Isn't this Java? :)  How can you keep a "soft"
>reference? Do you make it null or something symbolic?

Depending on the configuration of the cache I either directly keep the value
object or put it into a Reference (see
http://www.javasoft.com/j2se/1.3/docs/api/java/lang/ref/SoftReference.html).

TIA,

y un saludo,

Alex.

Reply via email to