gpt4 book ai didi

asp.net-mvc-3 - 带有 OutputCacheAttribute 的 mvc-mini-profiler

转载 作者:行者123 更新时间:2023-12-04 02:28:34 25 4
gpt4 key购买 nike

我在测试站点上使用 mvc-mini-profiler。当我在我的操作方法上放置一个 OutputCacheAttribute 时,分析器不会被执行并且总是返回他在缓存之前的最后一个值。

有没有办法告诉 mvc-mini-profiler 结果来自缓存,以便它可以更新他的状态?也许在客户端,我们可以看到这样的信息:

http://localhost/Home (from cache) 2.1ms,  +0.5ms 

最佳答案

将输出缓存应用于 Controller 操作也会缓存分析器结果。当 OutputCache 应用于 Controller 时,大部分 ASP.NET MVC 管道都不会执行。

您可以将页面生成时间的日期时间信息添加到分析器中,例如:

profiler.Step("Generated: " + DateTime.Now.ToString());

关于asp.net-mvc-3 - 带有 OutputCacheAttribute 的 mvc-mini-profiler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6823626/

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