IIS7 Web.Config缓存 - 这里有什么不同,它们如何结合在一起? [英] IIS7 Web.Config Caching - what are the differences here, and how does it all come together?

查看:164
本文介绍了IIS7 Web.Config缓存 - 这里有什么不同,它们如何结合在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IIS7中,我有能力设置缓存选项。这些选项被添加到我的web.config中......

In IIS7 I've got the ability to set caching options. These options are added to my web.config as such...

    <caching maxCacheSize="262144">
        <profiles>
            <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />
            <add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />
            <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />
            <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />
            <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" duration="00:00:30" />
        </profiles>
    </caching>

但是,我还得到了以下缓存

However, I've also got the following for "caching"

    <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="90.00:00:00" />
        <remove fileExtension=".js" />
        <mimeMap fileExtension=".js" mimeType="text/javascript" />
    </staticContent>

这两个配置有什么区别?它们都嵌套在< system.webServer> 标记中,因此它们对IIS7都有效。

What are the differences between these two configs? They are both nested in the <system.webServer> tag, so they're both valid for IIS7.

此外,使用这些方法的正确方法是什么?我目前只使用这是我的静态资源文件夹。我不会在其他任何地方使用此缓存。

Also, what is the right approach when using these? I currently only use this is my static assets folder. I don't use this caching on anything else.

提前致谢。

推荐答案

主要区别在于第一个缓存是服务器端(基本上将页面输出保留在内存中以供后续请求),第二个是客户端(将包含在响应头中,它告诉浏览器如何本地管理客户端计算机上的缓存文件。)

The main difference is that the first caching is server-side (basically keeps the page output in memory for subsequent requests), the second one is client side (will be included the response headers, it tells to the browser how to locally manage cached files on the client machine).

这篇关于IIS7 Web.Config缓存 - 这里有什么不同,它们如何结合在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆