Asp.net Mvc OutputCache属性和滑动到期

编程入门 行业动态 更新时间:2024-10-26 14:34:12
本文介绍了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属性和滑动到期

本文发布于:2023-11-12 09:34:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581126.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   net   Asp   OutputCache   Mvc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!