本文介绍了Asp Mvc OutputCache属性和滑动到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通话
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属性和滑动到期
发布评论