SQLCacheDependency 和 AppFabric 服务器
我遇到一种情况,我需要用新的系统替换当前基于文件的缓存依赖系统。我正在考虑使用 AppFabric 进行缓存。我想知道表通知应用程序数据更新的 SQLDependencyCaching 技术是否与 AppFabric 一起使用,就像与 ASP.NET 内置缓存一起使用一样?
I have a situation where I need to replace our current file based cache dependency system with a new one. What I am looking at is moving towards using AppFabric for caching. I was wondering if the SQLDependencyCaching technique where the table notifies the application of data updates works with AppFabric as it does with ASP.NET built in caching?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
AppFabric 缓存内不支持 SqlCacheDependency 机制(或者实际上不支持任何类型的依赖项)。
不过,AppFabric 1.1 引入了 DataCacheStoreProvider 类,该类可用于确保缓存始终与底层数据库同步。本质上,您创建一个继承自 DataCacheStoreProvider 的类,并在其上创建方法来告诉它如何读取和更新数据库。然后,您对缓存进行所有数据访问(添加对象、更新现有对象等),因此缓存始终具有最新版本的数据。然后,缓存调用您的提供程序类来更新数据库并保留您的更改。 此处提供了创建提供程序类的演练。
There is no support within AppFabric caching for the SqlCacheDependency mechanism (or in fact for any kind of dependency).
However, AppFabric 1.1 introduces the DataCacheStoreProvider class, which can be used to ensure that the cache is always in sync with the underlying database. In essence, you create a class that inherits from DataCacheStoreProvider and create methods on it which tell it how to read from and update your database. Then you do all your data access - adding objects, updating existing object etc - against the cache, so the cache always has the latest version of the data. The cache then calls your provider class to update the database and persist your changes. There's a walkthrough for creating a provider class here.
虽然 appfabric 中不支持它,但 NCache 中支持它。 NCache 具有缓存依赖性功能,可让您管理关系数据 1-数据元素之间的 1、1-n 和 mn 关系。缓存依赖性允许您保留缓存中数据的完整性。
though its not supported within appfabric, but supported within NCache. NCache has a Cache Dependency feature that lets you manage relational data with 1-1, 1-n, and m-n relationships among data elements. Cache Dependency allows you to preserve data integrity in the cache.
有一个 Windows Azure 输出缓存提供程序,它的工作方式与然而,SqlDependencyCache 确实具有良好的性能和其他优点。
您还可以编写自定义输出缓存提供程序并利用 Azure 缓存通知根据您的要求触发更新。
MSDN:在 ASP.NET 中构建和使用自定义 OutputCache 提供程序
There is a Windows Azure Output Cache provider it works somewhat differently to the SqlDependencyCache however it does have good performance and other benefits.
You could also write a custom output cache provider and leverage the Azure Cache notifications to trigger the update depending on your requirements.
MSDN: Building and Using Custom OutputCache Providers in ASP.NET