> -----Original Message-----
> From: Seyhan BASMACI (Internet Yazilimlari Yetkilisi) 
> 
> 
> thanks James, 
> 
> is it cause a performance problem calling formats.clear() for 
> each message ,

I'm not sure how much of a performance hit you would take.  The 
bottleneck in most applications is typically the database call anyway.

Keep in mind that "getting the message" and "formatting the 
message (replacing {0} with some value)" are 2 separate actions.

The latter is handled in MessageResources so you pay the cost of
that replacement, plus the cost of clearing a HashMap (which should
be minimal).


> caching feature seems good, I must use this caching feature also , 

The DBMessageResources that I wrote
(http://sourceforge.net/projects/struts) uses the O/R tool OJB 
(http://db.apache.org/ojb/) for it's underlying data access.

OJB offers excellent, configurable, caching.


> it seems to me meaningful to call formats.clear() when the 
> my cache reloaded ,,
> my DAO code inside getMessage only reads messages from our cache,
> if it knows cache reloaded it may conditionally call formats.clear(),

If you don't clear the HashMap every time, it won't bother to call
your method the next time.

>  if calling formats.clear() for each message does not cause 
> performance problem 
> I can simply put formats.clear() code inside getMessage method,,
> which way I must choose,,any suggestion? 
> 
> 



--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to