在ASP.NET MVC中以编程方式中止OutputCache持续时间 [英] Abort OutputCache duration programmatically in asp.net mvc

查看:73
本文介绍了在ASP.NET MVC中以编程方式中止OutputCache持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OutputCache属性在服务器端缓存我的操作的html输出.

I'm using the OutputCache attribute to cache my action's html output at the server-side.

很好,它可以工作,但是现在我遇到的情况是,内容很少更改,但是当它更改时,对于用户在下一个请求中看到新数据至关重要.

Fine, it works, but now I have a situation where the content changes rarely, but when it does, it's critical for the user to see the new data the very next request.

那么,有没有办法以编程方式中止页面缓存持续时间?

So, is there a way to abort the page cache duration programmatically?

推荐答案

是的,可以使用 HttpResponse.RemoveOutputCacheItem方法.检查这个问题:

Yes, it is possible using HttpResponse.RemoveOutputCacheItem Method. Check this question:

这篇关于在ASP.NET MVC中以编程方式中止OutputCache持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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