如何通过合理设置Cache-Control减少服务器访问次数?
- 内容介绍
- 文章标签
- 相关推荐
本文共计548个文字,预计阅读时间需要3分钟。
Cache-control常见的取值有private、no-cache、max-age、must-revalidate等,网页的缓存是由HTTP消息头中的Cache-control实现的。
“Cache-control”常见的取值有private、no-cache、max-age、must-revalidate等网页的缓存是由HTTP消息头中的“Cache-contr“Cache-control”常见的取值有private、no-cache、max-age、must-revalidate等 网页的缓存是由HTTP消息头中的“Cache-control”来控制的,常见的取值有private、no-cache、max-age、must-revalidate等,默认为private。其作用根据不同的重新浏览方式分为以下几种情况: (1) 打开新窗口 如果指定cache-control的值为private、no-cache、must-revalidate,那么打开新窗口访问时都会重新访问服务器。而如果指定了max-age值,那么在此值内的时间里就不会重新访问服务器,例如: Cache-control: max-age=5 表示当访问此网页后的5秒内再次访问不会去服务器 (2) 在地址栏回车 如果值为private或must-revalidate(和网上说的不一样),则只有第一次访问时会访问服务器,以后就不再访问。如果值为no-cache,那么每次都会访问。如果值为max-age,则在过期之前不会重复访问。
本文共计548个文字,预计阅读时间需要3分钟。
Cache-control常见的取值有private、no-cache、max-age、must-revalidate等,网页的缓存是由HTTP消息头中的Cache-control实现的。
“Cache-control”常见的取值有private、no-cache、max-age、must-revalidate等网页的缓存是由HTTP消息头中的“Cache-contr
