通知本地缓存缓存集群中的变化
我在我的 C# 应用程序中使用 appfabric 缓存。我已经启用了本地缓存。
当我从缓存集群中添加、删除、更新或删除项目时,我想通过我的 C# 代码发送已发生此类情况的通知。这可能吗?如果可能的话,如何实现?
我正在考虑在应用程序的 web.config 上进行设置,以轮询查找缓存集群的更新,但我担心这可能会出现性能问题,因此我想在我的代码中包含通知的触发器。
I am using appfabric caching in my c# application. I have enabled local cache.
When I add, remove, update or delete an item from my cache cluster I would like to send a notification that such has occurred via my c# code. Is this possible and if so how is it achieved?
I was considering setting it up on the web.config of my application to poll looking for updates to the cache cluster but I am concerned that this may have performance issues therefore I would like to include the trigger of the notification in my code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试启用本地缓存中的无效/更新缓存项目的通知,那么我有一些好消息给您:您不必编写任何 C# 代码来实现此目的,AppFabric 会为您做到这一点。请参阅此 MSDN 页面上的第二段。
您可以在 web 中配置本地缓存以接收来自群集的通知。或 app.config 或代码中当您实例化
DataCacheFactory
。您还需要在创建缓存时启用缓存本身的通知,例如本地缓存将轮询集群以获取通知;默认轮询间隔为 300 秒,但如果您愿意,您可以在配置中调整此间隔,具体取决于您认为缓存数据的易失性。
If you're trying to enable notifications for invalidating/updating cached items in the local cache, then I have some good news for you: you don't have to write any C# code to achieve this, AppFabric will do it for you. See the second paragraph on this MSDN page.
You can configure the local cache to receive notifications from the cluster, either in your web. or app.config or in code when you instantiate a
DataCacheFactory
. You'll also need to enable notifications on the cache itself when you create it e.g.The local cache will then poll the cluster for notifications; the default poll interval is 300 seconds but you can tune this in your config if you wish, depending on how volatile you believe your cached data to be.