gpt4 book ai didi

c# - OutputCache - 指定要缓存的内容

转载 作者:太空宇宙 更新时间:2023-11-03 11:07:55 26 4
gpt4 key购买 nike

我正在使用 OutputCache 属性 [OutputCache(Duration = 3600)] 来缓存返回 View 的 Controller 。但是该 View 包含一个 Helper 方法,该方法根据 Web.config 属性显示某些信息。问题是此信息也被缓存。有没有办法不缓存辅助方法信息。

最佳答案

很遗憾,ASP.NET MVC 2 及更高版本不支持 donut caching :

Due to differences in the way that ASP.NET MVC 2 processes request, data within the substitution block can be cached when it shouldn’t be. Substitution caching for ASP.NET MVC is not supported and has been removed from our ASP.NET MVC Futures project

这是一个 great article解释如何在 ASP.NET MVC 3 及更高版本中实现此目的。它基于 ASP.NET MVC Extensible Donut Caching Codeplex 上提供的软件包。

关于c# - OutputCache - 指定要缓存的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15113679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com