刷新企业库高速缓存后,外部应用程序更新它 [英] Refresh Enterprise Library Cache After External App Updates It

查看:95
本文介绍了刷新企业库高速缓存后,外部应用程序更新它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

摸索了好几个月和关闭后,我终于决定发布这件事。

After searching around for months on and off I finally decided to post this up.

我们有一个ASP.NET MVC应用程序,使用企业库缓存项。我们还使用了Windows服务,每隔一段时间更新这些缓存的项目。问题是,当窗口服务更新缓存项,MVC的网站没有看到更新缓存的项目,直到我们重置IIS。我们曾经想过把一些code在服务重新启动IIS服务,但认为有必须是一个更好的办法。这里似乎是谈到从外部应用程序删除项目另外一个职位,但还远远不够。

We have an ASP.NET MVC app that uses enterprise library to cache items. We also use a windows service that every so often updates those cached items. Problem is that when the windows service updates the cached items, the mvc website does not see the updated cached items until we reset IIS. We have thought about putting some code in the service to restart the IIS service but think there has got to be a better way. There seems to be one other post that talks about removing items from an external app, but it doesn't go far enough.

我们认为这是与在内存中的版本是本地高速缓存管理器的每个实例,但根本无法找到一种方法,把它放在一起。

We think it has something to do with the in memory version that is local to each instance of the cache manager but simply cannot find a way to bring it all together.

推荐答案

嗯,这是pretty的是它。正在使用由企业库缓存内存,和ASP.NET和Windows服务的应用程序都具有不同的存储空间。当您在一个更新缓存,你不更新中的其他缓存。

Well, that's pretty much it. The cache that is being used by the Enterprise Library is in-memory, and the ASP.NET and Windows Service applications both have different memory spaces. When you update the cache in one, you don't update the cache in the other.

在ASP.NET应用程序中存在的问题,以及,但似乎这是一个只读缓存,并且正在从服务执行写入操作。

The problem exists in the ASP.NET app as well, but it seems that this is a read-only cache, and you are performing the writes from the service.

您需要做的是建立一个高速缓存,这两个应用程序域可以共享,有很多方法可以做到这一点:

What you need to do is create a cache that both app domains can share and there are many ways to do this:

  • 存储在共享持久性存储的项目(文件系统,数据库等),这两个应用程序域可以方便地访问
  • 有一个缓存服务,将处理缓存项的更新,但是你将查询(通过WCF,例如)高速缓存项

在一般情况下,你正在寻找执行分布式缓存。为此,你应该阅读文章MSDN杂志名为分布式缓存上的路径可扩展性的更​​多信息,分布式缓存选项在.NET

In general, you are looking to perform "distributed caching". To that end, you should read the article in MSDN Magazine titled "Distributed Caching On The Path To Scalability" for more information on distributed caching options in .NET

这篇关于刷新企业库高速缓存后,外部应用程序更新它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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