多个Web站点之间共享缓存 [英] Sharing cache between multiple web-sites

查看:574
本文介绍了多个Web站点之间共享缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有大约50网站,在不同的应用程序池,即(使用微软企业库缓存应用程序块)从一个普通的缓存数据库中读取运行。

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).

我们目前有哪些每天早上在凌晨3点填充缓存的控制台应用程序。但是,我们要摆脱这个应用程序,并得到缓存自动刷新过期的项目,使用ICacheItemRefreshAction接口。

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.

我们打算在每个50 web站点的在Global.asax来创建我们缓存对象。然而,我担心的是,如果我们设置在Global.asax中一个高速缓存期满策略,使得每个50 web站点的将触发刷新操作,使数据重新缓存50次

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.

我们不希望只有1个网站,设置期满政策,那么49其他Web站点将有一个1网站的依赖,这是一个架构不行的。

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 no-no.

由于这些限制 - 任何建议?

Given these constraints - any recommendations?

推荐答案

坚持你有什么。

如果控制台应用程序在凌晨3点填充缓存是可以接受的执行,继续使用它。您可以随时更改在此这就是所谓的粒度,如果您需要刷新缓存增加/减少频繁。

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.

如果你想有机会ICacheItemRefreshAction,使更精细的粒度(即部分结果24分钟后掉出缓存,大约24小时后),则考虑在控制台应用程序更加灵活,因此它可以被告知其中的部分缓存无效并重新进行填充。

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.

信息从你的问题缺少会是完善的答案中有用的一个位的你为什么要摆脱控制台应用程序的,也许更重要的是,为什么你想要移动到使用 ICacheItemRefreshAction 接口?

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?

这篇关于多个Web站点之间共享缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆