OutputCache 未在整个持续时间内进行缓存

发布于 2024-09-06 17:17:40 字数 725 浏览 3 评论 0原文

我做了一个简单的测试用例。

默认.asp:

<%=now%>

web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="default.asp">
    <system.webServer>
        <caching>
            <profiles>
                <add extension=".asp" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="01:00:00" varyByQueryString="*" />
            </profiles>
        </caching>
    </system.webServer>
</location>

如果我请求default.asp 2次,页面会被缓存,那么日期时间值在一段时间内表示相同,但​​不是整个小时。

要测试此情况,请打开 default.asp 请求页面,直到该页面被缓存,然后等待 5 分钟并刷新页面。

我使用的是Windows 7 + IIS7.5

I made a simple testcase.

default.asp:

<%=now%>

web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="default.asp">
    <system.webServer>
        <caching>
            <profiles>
                <add extension=".asp" policy="CacheForTimePeriod" kernelCachePolicy="DontCache" duration="01:00:00" varyByQueryString="*" />
            </profiles>
        </caching>
    </system.webServer>
</location>

If i request default.asp 2 times the page's get cached en the datetime value says the same for a period of time but not for the whole hour.

To test this open default.asp request the page until it is cached then wait for 5 minutes and refresh the page.

I am using Windows 7 + IIS7.5

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

﹏雨一样淡蓝的深情 2024-09-13 17:17:40

您能否澄清一下 IIS 中应用程序的生命周期是多少? IIS 是否会因不使用而剔除应用程序?
测试这一点的一种方法是每 20 秒刷新一次页面。如果缓存页面保持原始时间的时间超过您提到的 5 分钟,则表明应用程序正在被剔除。当您再次请求该应用程序时,它会重新生成缓存版本。

Can you clarify what the lifetime of the application is in IIS. Could IIS be culling the application due to non use?
One way to test this out would be to keep refreshing the page every 20 seconds. If the cached page keeps the original time for longer than the 5 minutes you mentioned then this would point to the fact that the application is being culled. When you then request this app again it generates the cached version afresh.

吻安 2024-09-13 17:17:40

我进行了失败的请求跟踪并发现了以下内容。

如果页面不经常被命中,则即使未达到持续时间,缓存也会失效:
http://img819.imageshack.us/img819/7963/45303467.png

I did a failed request tracing and found the following.

If the page doesn't get frequently hit the cache invalidates even thought the duration isn't reached:
http://img819.imageshack.us/img819/7963/45303467.png

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文