各种应用之一缓存? [英] One Cache for various Applications?

查看:122
本文介绍了各种应用之一缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个应用程序 - 一个是一个asp.net网站,另一种是窗口服务

i have two applications - one is an asp.net website and the other is a windows service.

这两个应用程序所引用我的业务层(库项目),其本身会引用本身使用企业库数据应用模块来接收数据形成一个SQL Server 2005数据库我的数据访问层(库项目)。

both applications are referencing my business layer (library project), which itself is referencing my data access layer (library project) that itself uses the enterprise library data application block to receive the data form a sql server 2005 database.

目前我使用的System.Web.Caching.Cache对象在我的BL缓存我的一些对象:

currently i use the System.Web.Caching.Cache object in my BL to cache some of my objects:

public static System.Web.Caching.Cache Cache
	{
		get
		{
			if(cache == null)
			{
				if (System.Web.HttpContext.Current != null)
				{
					//asp.net
					cache = System.Web.HttpContext.Current.Cache;
				}
				else
				{
					//windows service
					cache = System.Web.HttpRuntime.Cache;
				}
			}
			return cache;
		}
	}

由于这两个应用程序都在自己的运行 - 它们都使用自己独立的Cache对象 - 这实际上是这个问题:

as both applications are running on their own - they both are using a separate Cache object on their own - and this is the problem actually:

如果我更改了asp.net网站对象,并将其保存到数据库。对象向此高速缓存关键是从缓存中删除 - 在asp.net应用程序的缓存!这很好。

if i change a object in the asp.net website and save it to the DB. the object to this cache key is removed from the cache - the asp.net application's cache! that's fine.

但Windows服务的缓存变得陈旧!

but the windows service's Cache becomes stale!

(反之亦然)

是有可能,这两个应用程序都使用相同的缓存?这两个应用程序的高速缓存?

is it possible that both applications are using the same Cache? One Cache for both applications?

唯一的选择,我有我想的是,我将不得不使用的SqlDependency与

the only option i have i think about is that i will have to use SqlDependency with

SQL Server 2005的基于通知的缓存失效

有没有别的办法?

编辑:
我刚刚发现 HTTP://www.$c$cplex.com/SharedCache 。我会试试看。
如因为速度将在发布候选状态,直到2009年中期。

i just found http://www.codeplex.com/SharedCache. i will give it a try. as because velocity will be in release candidate status until mid 2009.

推荐答案

您应该采取微软的新的免费的分布式缓存显著看速度。

You should take a significant look at Microsoft's new free distributed cache "Velocity."

下面是一个播客我关于这个问题所做的:
<一href=\"http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCachingWithMicrosoftsVelocity.aspx\" rel=\"nofollow\">http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCachingWithMicrosoftsVelocity.aspx

Here's a podcast I did on the subject: http://www.hanselman.com/blog/HanselminutesPodcast116DistributedCachingWithMicrosoftsVelocity.aspx

下面是MSDN上的细节: http://msdn.microsoft.com/en -us /数据/ cc655792.aspx

Here's details on MSDN: http://msdn.microsoft.com/en-us/data/cc655792.aspx

下面是下载和样品: HTTP://$c$c.msdn.microsoft.com

这篇关于各种应用之一缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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