Hi, One question about caching data in servletcontext, u said some thing about timestamp, what this timestamp do exactly, how will i come to know when to reload the data using this timestamp,
Also suppos the data i ahve to cache does not modify so often , but it modifies once in 15 - 20 days, but by some different application , so how will i refresh data in cache?? Ashish --- Wendy Smoak <[EMAIL PROTECTED]> wrote: > Joshua wrote: > > I thought I would be slick an attempt to cache the > Collections used to > > populate my forms drop down list boxes instead of > hitting the database > every > > time (The values may change daily). > > Assuming you don't reload (or stop/start) your > webapp daily, in which case a > ServletContextListener could be employed to place > the Collections into > application scope where they would live until the > next reload... > > I assume that Struts uses the iterator() method of > the Collection/List in > order to write out the <option> tags. Maybe it's > the toArray() method. In > any case... > > What if you implemented Collection (or List) and > held a timestamp, so that > when the iterator() method was called, you would > check to see if the data > was "expired" and if so, go read it from the > database before returning the > Iterator. That's going to cause a delay for the one > person who's unlucky > enough to request the page after the expiration, but > if you stagger the > expiration times, it'll only delay one person per > day per drop-down. > > I use the ServletContextListener approach, but the > contents of my dropdowns > don't change that often. > > -- > Wendy Smoak > Applications Systems Analyst, Sr. > Arizona State University PA Information Resources > Management > __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

