两个Web应用程序之间的缓存失效 [英] Cache invalidation between two web applications

查看:74
本文介绍了两个Web应用程序之间的缓存失效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在另一个应用程序(在同一台计算机上运行)中更新相关数据时,我需要使Web应用程序中的缓存无效.两个应用程序使用相同的数据库.我知道有SqlCacheDependency.在性能方面如何?Web应用程序中是否可以进行进程间通信(例如使用名称管道)?它是否优于SqlCacheDependency?

I need to invalidate cache in a web application when related data is updated in another application (running on the same machine). Both applications use the same database. I know there's SqlCacheDependency. How do is it in terms of performance? Is interprocess communication (e.g. using name pipes) an option in web applications? Does it outperform SqlCacheDependency?

推荐答案

这实际上非常简单,只需在每个Web应用程序中使用Web服务或页面操作即可.无论何时调用,Web服务都可以清除缓存的元素.

This is actually pretty simple to do by just using web services or a page action in each webapp. The web service can just clear a cached element whenever it is called.

当webapp A更新webapp B中缓存的数据时,只需让webapp A调用webapp B中的Web服务即可清除缓存,反之亦然.如果您想保护身份验证,也可以添加身份验证.

When webapp A updates the data that is cached in webapp B, just have webapp A call the web service in webapp B that clears the cache and vice versa. You can add authentication as well if you want to secure it etc.

任何时候我都必须与另一个Web应用程序进行通信,并在另一个我已完成的应用程序上下文中执行操作,方法是公开将执行我需要执行的操作的Web服务或页面(ashx文件).

Anytime I have had to communicate with another web application and perform an action within the context of the other app I have done it by exposing web services or pages (ashx files) that will perform whatever action I need.

这篇关于两个Web应用程序之间的缓存失效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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