velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <...@xyris.com>
Subject RE: Why have the caching stuff been removed ?
Date Tue, 13 Feb 2001 14:48:00 GMT
From: Thomas Fahrmeyer [mailto:thomas.fahrmeyer@einsurance.de]

> A code project seems to be very usefull. I think the caching
> stuff is so
> common that nearly every project can benefits from this piece
> of code. I'll
> move it into my own source tree until such a project was etablished.
>
> I'm going to modify the code anyway - a little performance
> improvement.
>
> If the GlobalCache.get(key) is called and the the key is not present a
> NullPointerException comes up, because the content of the
> CachedObject is
> null. That forces to call contains(key) before, what is an
> unnecessary time
> consuming operation on a large cache. ;(
>
> Why can't "get(key)" catches the content==null problem and
> just returns null
> as result. So, I can call contains(key) only if I really want to know
> whether the object is inside. The method get(key) is faster,
> because it
> access a HashMap(table) instead of iterating over all keys to
> determine
> whether the key is there or not.
>
> Just a suggestion

Great - remember it for contribution later when/if that project gets
established and/if the GlobalCache gets added.

geir



Mime
View raw message