Asp.net Mvc OutputCache属性和滑动到期 [英] Asp.net Mvc OutputCache attribute and sliding expiration
本文介绍了Asp.net Mvc OutputCache属性和滑动到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通话
http://foo/home/cachetest
对于
[UrlRoute(Path = "home/cachetest")]
[OutputCache(Duration = 10, VaryByParam = "none")]
public ActionResult CacheTest()
{
return Content(DateTime.Now.ToString());
}
无论我多长时间刷新一次页面,都会每10秒显示一次相同的内容.
will show the same content for every 10 seconds no matter how often i refresh page.
是否可以轻松添加滑动到期时间,以便在刷新页面后10秒后它不会更改?
Is it possible to easily add sliding expiration so it would NOT change after 10 seconds in case i have refreshed the page?
推荐答案
阅读了OutputCacheAttribute
的源代码之后,我认为没有 easy 方式可以做到这一点.
Been reading the source for the OutputCacheAttribute
and I don't think there's an easy way to do this.
您最有可能需要创建自己的解决方案.
You're most likely going to need to create your own solution.
这篇关于Asp.net Mvc OutputCache属性和滑动到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文