IIS7 Web.Config Caching - what are the differences here, and how does it all come together?

前端 未结 2 1511
灰色年华
灰色年华 2021-01-11 18:33

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

    
                


        
相关标签:
2条回答
  • 2021-01-11 19:10

    I've noticed that people often confuse the things above and write articles where recommend things as in the first block, i.e. output caching for static resources

    Output caching:

    Output caching is unnecessary for static files, such as HTML, JPG, or GIF files, and can cause more memory overhead for dynamic ASP.NET or PHP pages that read from a database that changes frequently

    Thus

    <add extension=".png" ../>
    <add extension=".jpeg" ../>
    etc.
    

    is useless at least when you don't have ashx http handler for .png or .jpeg etc.

    0 讨论(0)
  • 2021-01-11 19:16

    The main difference is that

    • the first is for server-side caching of dynamic output such as aspx pages (basically keeps the page output in memory for subsequent requests). As @artem-vertiy's answer points out, using it for static content makes no sense.

    • the second one is 'internet-side' : it is implemented by writing standard response headers, it tells both client browsers and public proxies how to manage cached files.

    0 讨论(0)
提交回复
热议问题