This is ok, but doesnt work if you have no control over the data changes. 

Some of our data in the database gets changed by other legacy apps, so we've 
implemented a CacheManager through 
which we obtain cached data. If the data item is not currently cached we retrieve it 
from the EJB tier, store it in the session or 
servlet context depending on the data, and if required use a Timer to schedule for the 
data attribute to be cleared from the 
session/context.

Regards,
Menno

17/04/2001 06:58:50, "Nanduri, Amarnath" <[EMAIL PROTECTED]> wrote:

>I would say implement a pattern like the Observer which watches for any
>changes to the data list. If any changes occur it immediatly updates the
>internal list. So you will always have an updated list (no matter what) and
>it is done automatically behind the scenes...
>
>cheers,
>Amar..
>
>-----Original Message-----
>From: Greg Reddin [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, April 17, 2001 9:46 AM
>To: [EMAIL PROTECTED]
>Subject: RE: how to cache lists?
>
>
>You could store the data in Application context as you've stated, but
>provide a
>mechanism for that data to be refreshed (either automatically or manually)
>without restarting the server.  I haven't implemented this at all, but it
>seems
>possible.  I've considered using some sort of date/time stamp, a boolean
>flag,
>or some other means to make the data automatically refresh.  Otherwise you'd
>have to create some admin actions that would manually be invoked to refresh
>the
>data.
>
>-----Original Message-----
>From: [EMAIL PROTECTED] 
>Sent: Tuesday, April 17, 2001 8:34 AM
>To: [EMAIL PROTECTED]
>Subject: RE: how to cache lists?
>
>
>Alex, It is a good idea from a developers point of view. But when U say this
>to an IT manager and also tell him that U have to restart the webserver when
>ever new data is added, he/she will not allow U to do that. I faced the same
>situation but gave up on the idea of caching the data at application level.
>
>Thanks,
>Uday.
>
>-----Original Message-----
>From: Alex Colic [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, April 17, 2001 8:15 AM
>To: Struts
>Subject: how to cache lists?
>
>
>Hi,
>
>Lets say you have a web app that runs over a number of web pages in a wizard
>fashion. On each one of these pages you need to present the user with a
>select box holding lists. e.g. locations, cities, etc. This data is read
>from a database and rarely changes.
>
>How would you cache these lists so that as each user access this site they
>do not need to have this info downloaded again?
>
>I was thinking in the init() of my ActionServlet to access the database and
>get these lists then place them in the session with Application scope. I
>think this would allow each user to access the data without reaccessing the
>database.
>
>Any comments or suggestions are appreciated.
>
>Regards
>
>Alex
>



Reply via email to