如何在网站中缓存静态页面和动态页面

问题描述

我需要为网站的静态页面进行缓存。如果要指定缓存CSS,JS或图像,我从How to configure static content cache per folder and extension in IIS7?获得的以下代码表示“位置”。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <!-- Note the use of the 'location' tag to specify which 
       folder this applies to-->
  <location path="images">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:15" />
      </staticContent>
    </system.webServer>
  </location>
</configuration>

1)对于以下代码,是否表示它会在不指定扩展名的情况下缓存您网站中的所有静态内容(js,css,图像)?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:15" />
    </staticContent>
  </system.webServer>
</configuration>

2)通过为静态页面指定以上内容,是否会影响我在网站中拥有的那些动态页面(窗体)?

3)我如何为动态页面(窗体)缓存1小时?

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)