简体   繁体   English

分布式缓存(AppFabric)和缓存依赖性

[英]distributed caching (AppFabric) and cache dependencies

Is it possible to have 'Cache Dependencies' in AppFabric, or any other distributed cache system, similar to what you can do using the HttpRuntime cache of ASP.Net, using the CacheDependency class? 是否有可能在AppFabric或任何其他分布式缓存系统中具有“缓存依赖项”,类似于使用CacheDependency类使用ASP.Net的HttpRuntime缓存可以执行的操作?

The scope of this is to have say a UserControl attached to a 'key' of the cache. 这样的范围是说将UserControl附加到缓存的“键”上。 If the cache entry changes, the usercontrol is invalidated and re-loads itself. 如果缓存条目发生更改,则usercontrol将无效并重新加载自身。 Is this possible? 这可能吗?

After some research and testing - AppFabric does support something similar to the above, which are called 'Cache Notification Callbacks'. 经过研究和测试-AppFabric确实支持与上述类似的功能,称为“缓存通知回调”。 Basicaly, you can attach to items/regions of the cache, and the system will raise events when the cache is changed. 基本上,您可以附加到缓存的项目/区域,并且当更改缓存时,系统将引发事件。

However such notifications are not instant, and use a 'polling' mechanism. 但是,此类通知不是即时的,而是使用“轮询”机制。 This is something which one must keep in mind, as at first I was thinking that the system is not working. 必须牢记这一点,因为起初我以为该系统无法正常工作。 The default polling is 300seconds (5 minutes), so it might take some "time" to get the notification. 默认轮询为300秒(5分钟),因此可能需要一些“时间”才能获得通知。 This can be changed to any other interval, and especially for testing. 可以将其更改为任何其他间隔,尤其是对于测试。

I've tried this out and can confirm its working. 我已经尝试过了,可以确认其正常工作。 Details on how to implement can be found on the MSDN link: http://msdn.microsoft.com/en-us/library/ee808091(v=azure.10).aspx 可以在MSDN链接上找到有关如何实现的详细信息: http : //msdn.microsoft.com/zh-cn/library/ee808091( v= azure.10).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM