HttpRuntime.Cache Multi WebSite

HttpRuntime.Cache Multi WebSite

Old forum URL: forums.lhotka.net/forums/t/4929.aspx


JoOfMetL posted on Tuesday, June 03, 2008


Hello,

I am currently using 'HttpRuntime.Cache' for caching data.

I have 3 differents Webs site:

      1 reserved for staff to administer data
      1 customer site
      1 WebService

My problem: If I load data on the customer site, I must invalidate if the data changes. But the data are changed through the Admin Site or by the webService. But the site does not communicate together. Yet I'd like to make data cache. Any idea?

Thank you

JoeFallon1 replied on Tuesday, June 03, 2008

The thing they have in common is the Database. So use Database cache invalidation. There are newer techniques available in newer versions of SQL Server and Visual Studio. But you can always use the old standby of polling a "change table" in the DB. If the "changeid" is the same as the last time you polled you leave the item in the cache. Whenever a table is edited in the DB a trigger runs to modify the changeid in the change table. (If it happens to be one of the ones you want to monitor for changes.) You actually cache a small item and then tie your BO to it as a cache dependency object. So when you clear your small item (because the table in the DB changed and the changeid was incremented) the real BO leaves the cache with it.

There are lots of articles on this technique. I think I modified the one suggested by Peter Bromberg about 4 years ago.

Joe

 

JoOfMetL replied on Tuesday, June 03, 2008


Thank You.

Copyright (c) Marimer LLC