Expires 和 Cache-Control 标头有什么区别? [英] what’s the difference between Expires and Cache-Control headers?

查看:32
本文介绍了Expires 和 Cache-Control 标头有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ExpiresCache-Control 标头有什么区别?

What’s the difference between Expires and Cache-Control headers?

推荐答案

Cache-Control 是在 HTTP/1.1 中引入的,提供了比 Expires 更多的选项.它们可以用来完成同样的事情,但 Expires 的数据值是 HTTP 日期,而 Cache-Control max-age 允许您指定相对时间量,以便您可以指定请求页面后 X 小时".

Cache-Control was introduced in HTTP/1.1 and offers more options than Expires. They can be used to accomplish the same thing but the data value for Expires is an HTTP date whereas Cache-Control max-age lets you specify a relative amount of time so you could specify "X hours after the page was requested".

HTML Cache control 是一个非常相似的问题,并且有一个很好的链接到缓存教程,应该回答您的大部分问题(例如,http://www.mnot.net/cache_docs/#EXPIRES).总而言之,当您需要更多地控制缓存的完成方式时,建议将 Expires 用于图像和 Cache-Control 等静态资源.

HTML Cache control is a very similar question and has a good link to a caching tutorial that should answer most of your questions (e.g., http://www.mnot.net/cache_docs/#EXPIRES). To sum up though, Expires is recommended for static resources like images and Cache-Control when you need more control over how caching is done.

这篇关于Expires 和 Cache-Control 标头有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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