Hi The data which i want to cache has about 10000 rows and i want to cache it in may be servlet context, what is the best way to cache it, do i just create a java bean and cache it or some kind of mechanism already exist like Hibernation (i am not sure what is does)
Ashish --- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote: > What kind of data is it? Is it a read-only set of > data? How often is > it updated? Who or what can update it? > > There's any number of ways to do things like this, > which is the best > option depends on the particulars of your use case. > > You might be able to cache the data in Javascript > arrays in the user's > browser in a hidden frame. This is a fantastic > approach for data that > doesn't change frequently and that is read-only. > Removes potentially a > lot of data being passed in different spots > throughout the app, but it > does complicate your front-end a little more. > > You might be able to cache it in the session. This > can be good if the > data set is small, read-only and needed for server > processing at various > points. This can lead to problems in distributed > environments though, > so you need to be careful. > > You might be able to have a small cache database > server running along > side your app server, something like MySQL for > example, that has temp > copies of the data. The benefit to this is you have > the full power of > the RDBMS to work with, so you might be able to do > triggers to update > the DB2 database when appropriate if it's a one-way > sort of thing. > > As for the idea of update triggers, sure, you can > almost certainly put > something together to do this. I haven't done a > whole lot with DB2, but > I'd bet there's some mechanism you could use to > notify your cache server > of the update. I'd suspect the best approach would > be to notify it a > change took place but DON'T send the updated data... > Let the cache > server do a query to DB2 and get the updated data > set. Writing a > well-constructed stored procedure to do this would > probably be the best > bet. You could also just poll DB2 for changes if > your application can > tolerate some lag in updates to the cached data. > > Really though, the first question to ask is whether > what you want to > cache is read-only or has to support updates. If > it's the former, you > have a lot of options. It it's the later, things > get a little trickier. > By the way, I think I've done some variation of > all these approaches > at one time or other, so I can try and expand on > things if you need me to. > > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > > Dakota Jack wrote: > > Whatever code updates the database will have to > somewhere and somehow > > notify the code that updates the cache. It is > that simple. > > > > Jack > > > > > > > > > > On Sun, 28 Nov 2004 15:25:56 -0800 (PST), Ashish > Kulkarni > > <[EMAIL PROTECTED]> wrote: > > > >>Hi > >>what is the best way to cache data in web > application, > >>I have a table in AS400 DB2 database which i want > to > >>cache in application server to improve > performance, > >>Also is it possible to have a external trigger > which > >>will update the cache if the data base is updated > by > >>some external process > >> > >>Ashish > >> > >>__________________________________ > >>Do you Yahoo!? > >>Meet the all-new My Yahoo! - Try it today! > >>http://my.yahoo.com > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: > [EMAIL PROTECTED] > >>For additional commands, e-mail: > [EMAIL PROTECTED] > >> > >> > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]