Hello All, I save a Hashtable of stock symbols + prices to the cache. The prices are updated every 30 minutes and saved to a database table. I would like to always have the latest prices in the cache...is there a way to dynamically update a cache object ? Pointers appreciated Thanks
Do you want the latest price prior to saving to the database or the price from the database? "hharry" wrote in message news:1187288190.606898.10300@r34g2000hsd.googlegroups.com... > Hello All, > > I save a Hashtable of stock symbols + prices to the cache. The prices > are updated every 30 minutes and saved to a database table. > > I would like to always have the latest prices in the cache...is there > a way to dynamically update a cache object ? > > > Pointers appreciated > Thanks >
The basic pattern is as follows (pseudo-code): 1) get the "Stuff" - from the web, wherever 2) Store it in Cache with a timed expiration 3) Store it in the database if you want Your "GetMyStuff" method will: 1) check if the cache item is null 2) if so, get the Stuff and update the Cache item 3) if not null, just get it right out of the Cache This can all be done inside a single "getMyStuff" method so that the caching part is opaque to the user/ caller. -- Peter Recursion: see Recursion site: http://www.eggheadcafe.com unBlog: http://petesbloggerama.blogspot.com BlogMetaFinder: http://www.blogmetafinder.com "hharry" wrote: > Hello All, > > I save a Hashtable of stock symbols + prices to the cache. The prices > are updated every 30 minutes and saved to a database table. > > I would like to always have the latest prices in the cache...is there > a way to dynamically update a cache object ? > > > Pointers appreciated > Thanks > >