etag

浅谈浏览器的缓存机制

只愿长相守 提交于 2019-12-01 00:25:45
浏览器的缓存可分为HTTP缓存和离线缓存,下面将分别介绍 HTTP缓存 只有GET请求能被缓存,POST不能被缓存。 Modified Time/ETag/Expires/Cache都是HTTP协议的缓存策略 先来一个例子 当我们第二次访问百度首页,在Chrome的Network面板中打开一个静态文件时会发现响应的status是: 200 OK (from disk cache) ,不是应该返回304 Not Modified吗?如果你知道答案,那就可以忽略本文了。 Cache-Control 简介 w3.org 的定义是:“The Cache-Control general-header field is used to specify directives which MUST be obeyed by all caching mechanisms along the request/response chain.” 这是一个通用首部字段(就是请求报文和响应报文都能用上的字段),用来控制HTTP缓存的行为。 例如: Cache-Control: max-age=3600, public public 意味着这个响应可以被任何人缓存 max-age 则表明了该缓存有效的秒数,允许你的网站被缓存将大大减少下载时间和带宽,同时也提高浏览器的载入速度。 也可以通过设置 no-cache

浅谈浏览器的缓存机制

允我心安 提交于 2019-11-30 21:14:14
浏览器的缓存可分为HTTP缓存和离线缓存,下面将分别介绍 HTTP缓存 只有GET请求能被缓存,POST不能被缓存。 Modified Time/ETag/Expires/Cache都是HTTP协议的缓存策略 先来一个例子 当我们第二次访问百度首页,在Chrome的Network面板中打开一个静态文件时会发现响应的status是: 200 OK (from disk cache) ,不是应该返回304 Not Modified吗?如果你知道答案,那就可以忽略本文了。 Cache-Control 简介 w3.org 的定义是:“The Cache-Control general-header field is used to specify directives which MUST be obeyed by all caching mechanisms along the request/response chain.” 这是一个通用首部字段(就是请求报文和响应报文都能用上的字段),用来控制HTTP缓存的行为。 例如: Cache-Control: max-age=3600, public public 意味着这个响应可以被任何人缓存 max-age 则表明了该缓存有效的秒数,允许你的网站被缓存将大大减少下载时间和带宽,同时也提高浏览器的载入速度。 也可以通过设置 no-cache

浅谈浏览器的缓存机制

99封情书 提交于 2019-11-30 21:06:24
浏览器的缓存可分为HTTP缓存和离线缓存,下面将分别介绍 HTTP缓存 只有GET请求能被缓存,POST不能被缓存。 Modified Time/ETag/Expires/Cache都是HTTP协议的缓存策略 先来一个例子 当我们第二次访问百度首页,在Chrome的Network面板中打开一个静态文件时会发现响应的status是: 200 OK (from disk cache) ,不是应该返回304 Not Modified吗?如果你知道答案,那就可以忽略本文了。 Cache-Control 简介 w3.org 的定义是:“The Cache-Control general-header field is used to specify directives which MUST be obeyed by all caching mechanisms along the request/response chain.” 这是一个通用首部字段(就是请求报文和响应报文都能用上的字段),用来控制HTTP缓存的行为。 例如: Cache-Control: max-age=3600, public public 意味着这个响应可以被任何人缓存 max-age 则表明了该缓存有效的秒数,允许你的网站被缓存将大大减少下载时间和带宽,同时也提高浏览器的载入速度。 也可以通过设置 no-cache

浅谈浏览器的缓存机制

雨燕双飞 提交于 2019-11-30 21:03:03
浏览器的缓存可分为HTTP缓存和离线缓存,下面将分别介绍 HTTP缓存 只有GET请求能被缓存,POST不能被缓存。 Modified Time/ETag/Expires/Cache都是HTTP协议的缓存策略 先来一个例子 当我们第二次访问百度首页,在Chrome的Network面板中打开一个静态文件时会发现响应的status是: 200 OK (from disk cache) ,不是应该返回304 Not Modified吗?如果你知道答案,那就可以忽略本文了。 Cache-Control 简介 w3.org 的定义是:“The Cache-Control general-header field is used to specify directives which MUST be obeyed by all caching mechanisms along the request/response chain.” 这是一个通用首部字段(就是请求报文和响应报文都能用上的字段),用来控制HTTP缓存的行为。 例如: Cache-Control: max-age=3600, public public 意味着这个响应可以被任何人缓存 max-age 则表明了该缓存有效的秒数,允许你的网站被缓存将大大减少下载时间和带宽,同时也提高浏览器的载入速度。 也可以通过设置 no-cache

How to use Windows Azure Table Storage Timestamp or Etag field

為{幸葍}努か 提交于 2019-11-30 19:02:47
问题 I am developing a node.js application on Windows Azure Websites (IISNode) and have installed the Azure SDK module for node.js my question is how to use the etag or timestamp field in table storage. Is it a matter of "me" doing something e.g: if (entities[0].Timestamp == newEntity.Timestamp) // commit this update because we are dealing with the latest copy of this entity else // oops! one of the entities is newer than the other, better not save it Or do I need to listen for a error returned by

how does a etag work in expressjs

末鹿安然 提交于 2019-11-30 02:42:56
Expressjs automatically send etags. I would like to know how the etag is generated..is it based on the content that is generated dynamically by the get routine. or is there way I can mainpulate it, by not even going through the process of generating the content(dynamic content - from DB) and pass back etag as same. may be a middleware which start with just checking if it is valid session id and pass back the same etag that the client gives or may be based of the url + session id..that way it will be unique. and end the request there rather going through the whole db call and all those stuff.

你应该知道的HTTP头------ETag

和自甴很熟 提交于 2019-11-29 21:29:16
在HTTP1.1规范中,新增了一个HTTP头信息:ETag。对Web开发者来说,它是一个非常重要的信息。它是用作缓存使 用的 两个主 要的 头信息之一 (另一个是Expires)。除此之外,在REST架构中,它还可以用于控制并发操作( 上节 中已经大 致介绍 AtomPub中控 制并发的流 程)。那么ETag是什么?它又几种类型?强ETag与弱ETag之间有什么区别。? 如何计算 ETag值?它与Last-Modified头 信息在使用上有什 么区别? 本节主要围绕这几个方面叙述一下自己的理解。 目录: 什么是ETag? 计算ETag值 ETag的类型以及他们之间的区别 ETag与Last-Modified头信息用途上的区别 什么是ETag? ETag:是实体标签(Entity Tag)的缩写。ETag一般不以明文形式相应给客户端。在资源的各个生命周期中,它都具有不 同 的 值,用 于标 识出资源的状态。当资源发生变更时,如果其头信息中一个或者多个发生变化,或者消息实体发生变化 ,那 么 ETag也随之发生 变 化。 ETag值的变更说明资源状态已经被修改。往往可以通过时间戳就可以便宜的得到ETag头信息。在服 务端中如果发回给 消费 者的相应 从 一开始起就由ETag控制,那么可以确保更细粒度的ETag升级完全由服务来进行控制。服务 计算ETag值, 并在相 应客户端请求时将

Should HTTP 304 Not Modified-responses contain cache-control headers?

给你一囗甜甜゛ 提交于 2019-11-29 20:24:03
I've tried to understand this, and searched SO for similar questions, but I still don't have a 100% understanding on how this is supposed to work. I get this response on a request for an image resource: Response Headers Server Apache-Coyote/1.1 Date Mon, 19 Oct 2009 09:04:04 GMT Expires Mon, 19 Oct 2009 09:06:05 GMT Cache-Control public, max-age=120 Etag image_a70703fb393a60b6da346c112715a0abd54a3236 Content-Disposition inline;filename="binary-216-420" Content-Type image/jpg;charset=UTF-8 Content-Length 4719 The desired behavior is that the client should cache this for 120 seconds, then

Why isn't my javascript & css caching?

随声附和 提交于 2019-11-28 23:43:22
It's appears ONLY javascript and css are not caching ... but images are caching. I am using Firebug and when I refresh the page, I notice in Firebug a lot of 200 HTTP responses for js/css but am receiving 304 HTTP codes (content not modified) for all of my images. So it appears that my JS and CSS are not caching. Also, when using YSlow to help determine the problem with my JS/CSS content not caching, it informs me that: There are 4 components with misconfigured ETags http://www.example.com/css/basic.css http://www.example.com/js/ga.js http://www.example.com/js/dojo/dojo.js Listed below is my

Youtube API V3 and Etag

大城市里の小女人 提交于 2019-11-28 20:31:19
I use the youtube api v3 and i would like to understand how does the Etag. I would like to use it for what it takes to cache purpose but I do not know what to do in PHP. Could you tell me the steps to follow once the etag recovered ? please. Thanks for help. Redtopia According to the youtube docs ( https://developers.google.com/youtube/v3/getting-started#etags ), an eTag is basically used to determine if a resource has changed. Use them for: Optimization - Caching youtube resources in your app can reduce bandwidth and latency. When caching, store the eTag so that you can include it when