跨两个IIS应用程序共享HttpRuntime.Cache [英] Sharing an HttpRuntime.Cache across two IIS applications

查看:559
本文介绍了跨两个IIS应用程序共享HttpRuntime.Cache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS中有两个ASP.NET 2.0应用程序;公共预订系统和管理系统来管理价格。有一个共享DLL项目访问数据库,由两个应用程序使用。

I have two ASP.NET 2.0 applications in IIS; a public booking system and an admin system to manage prices. There is a shared DLL project that accesses the database, used by both applications.

为了提高性能,价格缓存在DLL代码中,以便在每次请求时保存命中数据库。但是,当管理员更改价格时,缓存会在管理应用程序上刷新(显然它不会在公共应用程序上刷新)

To improve performance, the prices are cached in DLL code to save hitting the database on every request. However, when the administrator changes the prices, the cache is refreshed on the admin application (and obviously it isn't refreshed on the public application)

所以,对于这个问题。是否可以配置IIS以便这两个应用程序共享HttpRuntime.Cache?如果是这样,应该如何设置?

So, to the question. Is it possible to configure IIS so that these two applications share the HttpRuntime.Cache? If so, how should it be set up?

推荐答案

这将超过两个应用程序 - 他们不应该分享相同的DLL内存堆,这是需要的。您需要的是两者之间的通信渠道,并让管理员网页通知缓存的更改 - 这将导致刷新。

That would beat the point of having two applications - they should not share the same DLL memory heap, that would be needed. What you need is a communications channel between the two and have the admin web-pages notify about changes to the cache - which would cause a refresh.

可能很简单,但也许你发布的简单页面导致缓存检查更新?或者 - 让应用程序根据时间戳立即检查更新。

May be something simple, but maybe a simple page you post to that causes the cache to check for updates? Or - have the application check for updates now and again based on a time stamp.

(另一种选择是创建缓存所在的服务,但我认为是超出简单解决方案的范围)

(Another option is to create a service where the cache resides, but I think that is outside the scope of a simple solution)

这篇关于跨两个IIS应用程序共享HttpRuntime.Cache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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