开发者

Sharing cache between multiple web-sites

We have about 50 web-sites, running in different application pools, that read from a common cache database (using Microsoft Enterprise Library Caching application block).

We currently have a console application which populates the cache at 3AM every morning. However, we want to get rid of this application and get the cache to automatically refresh expired items, using the ICacheItemRefreshAction interface.

We were going to create our cache object in the Global.asax of each of the 50 web-sites. However, my concern is that if we set a cache-expiration policy in Global.asax, that each of the 50 web-sites will trigger a refresh action, causing the data to be re-cached 50 times.

We don't want only 1 web-site to set the expiration policies, as then the 49 other web-sites will have a dependency on that 1 web-site, and that's an architecture n开发者_开发知识库o-no.

Given these constraints - any recommendations?


Stick with what you've got.

If the console applications populating the cache at 3am is performing acceptably, continue using it. You can always change the granularity at which it's called if you need to refresh the cache more/less frequently.

If you want to chance to ICacheItemRefreshAction to enable finer granularity (i.e. some items fall out of the cache after 24 minutes, some after 24 hours), then consider making the console application more flexible so it can be told which parts of the cache to invalidate and re-populate.

The one bit of information missing from your question that'd be useful to refine the answer is why do you want to get rid of the console app and, perhaps more importantly, why do you want to move to using the ICacheItemRefreshAction interface?


Perhaps you can look at an alternative caching solution like memcached, NCache or Velocity.

With that you can have a cache shared by all sites.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜