In ASP. NET Web APIs, cache is implemented through ETag, and apietag
Generally, the Server is stateless. in ASP. NET Web APIs, we can generate the ETag attribute in the Server response body and play a cache role. The general implementation principle is:1. An ETag attribute is returned in the response body of the server.2. The client passes the attribute value of
Basic knowledge1) What is "last-modified "?When the browser requests a URL for the first time, the server returns 200, and the content is the resource you requested, at the same time, there is a last-modified attribute to mark the last modification time of this file on the service end. The format is similar to this:Tue, 24 Apr 2012 13:53:56 GMT
When the client requests this URL for the second time, according to the HTTP protocol, the browser will send the IF-modified-since header to the server
HTTP response last-modified and ETag
[Date: 2008-06-16]
Source:
[Font: Big Small]
Basic knowledge 1) What is "last-modified"?When the browser requests a URL for the first time, the server-side return status is 200, the content is the resource you requested, and there is a last-modified attribute that marks the last time the file was modified at the end of the service period, similar in format:Last-modified:fri,
In today's Blog, some Web applications need to parse a lot of RSS feeds. How to improve efficiency is a very important issue. This is listed in Magpierss 's Features: HTTP Conditional GETs Save bandwidth and speed up download Intelligent use of last-modified and ETag. The Etag here caught my attention.
What is Etag?
By reading the RFC 2616 , I got a little i
");
2. Use the etag Header
Many times may not be used to determine whether the content is updated. You can use the etag header, which is an identifier for content calculation. The calculation method can be determined by yourself, such as CRC32 and MD5.
Etag and if-None-match
Etag corresponds to if-None-match
Expires, Cache-control, last-modified, ETag are all in the return header of the HTTP response
Used to control the browser client cache behavior.
1.Expires is defined in http/1.0, cache-control:max-age=xxx is defined in http/1.1,
For backwards compatibility, only using Max-age is not enough.
When a Web resource is accessed, it is cached by the browser and will be accessed again later by the same resource.
Check that the cache is out of date.
expires sp
Series Navigation Address http://www.cnblogs.com/fzrain/p/3490137.html
This article uses an open-source framework, CacheCow, to implement resource caching for Http requests. This article mainly introduces server-side caching.
The cache technology can improve the performance of Web APIs and reduce the server overhead. We call this cache form Conditional request (Conditional Requests ). Specifically, the client attaches a request header ETag to the
is the same, but it is only for proxy server cache;(3), public: Indicates that the response can be cached by any buffer;(4), private: Only for individual users, but not the proxy server cache;(5), No-cache: Force the client to send the request directly to the server, that is, each request must be sent to the server. The server receives the request and then determines whether the resource is changed, returns the new content, or returns 304 without changing. This is easy to misunderstand, making
As blogs are prevalent today, some Web applications need to parse a large number of "> RSS feed. How to improve efficiency is a very important issue. In features of magpierss, this article lists the following:"> HTTP conditional getsSave bandwidth and speed up download times with intelligent use of last-modified and etag .. Here etag caught my attention.
What is etag
After a long history of pseudo-static exploration, we found that the following methods can be used to achieve pseudo-static SEO and reduce server pressure.> Access the PHP page
> Last-Modified is generated based on the Content Update Time, And etag is generated based on the file name and content Update time.
> Compare the client data, such as viewing the Last-Modified of the client browser and comparing etag
Smart developers will use the HTTP header for Last-modified and ETAGS requests, which can take advantage of caching by clients such as browsers. Because the server first generates the LAST-MODIFIED/ETAG tag, the server can later use it to determine if the page has been modified. Essentially, the client requires the server to validate its (client) cache by passing the token back to the server.The process is as follows:
The client requests a
Browser cache, also known as HTTP cache, refers to when we browse the site, the browser will store a copy locally, so that the next time you visit the same URL can no longer connect to the server, directly from the browser local cache to obtain resources. The server-side program can control the cache behavior through HTTP cache headers, reduce the burden on the server, shorten the response time, and significantly improve the performance of the website. HTTP Cache related head has Last-modified/
Address: http://blog.chinaunix.net/uid-20614434-id-2999833.html
Author: finalbsdDate: 2008-07-08Previously, etag only provided the simplest description of resumable upload without further research. I studied for a while today, hoping to answer the question of Laurence, haha :)
1. Concept of resumable uploadResumable upload can be divided into two parts: one is a breakpoint and the other is a resumable upload.
BreakpointThe reason is that during the d
This series of articles will discuss how to optimize client caching policies through ASP.net server-side technology, and make this strategy configurable and extensible. We want to understand the impact of the relevant attributes on the client cache from the HTTP protocol, to how ASP.net controls these properties to implement our caching strategy.HTTP basic knowledgeSince the discussion involves client-side caching, it is a simple introduction to how the HTTP protocol controls client caching, whi
return a special HTTP status code of 304, which means "this data has not changed since the last request". What progress does this make? When the server sends a status code of 304, the data is no longer resent. You only get this status code. So when the data is not updated, you don't need to download the same data again and again; The server assumes you have local cache data.All modern browsers support recently modified (last-modified) data checks. If you've ever visited a page, re-visited the s
Apache turns off the Etag and Last-Modified methods, and only boring people like me will do this. Haha, what will happen if we turn off etag and last-modified. Do not ask me what these two parameters are. The Etag is disabled as follows: add an noneFileETagnone to disable the Last-Modified
Apache disables Etag and Las
Etag: "5d8c72a5edda8d6a:3239″The client's query update format is like this:If-none-match: "5d8c72a5edda8d6a:3239″If the etag does not change, the status 304 is returned.That is, after the client makes a request, the Http reponse header contains Etag: "5d8c72a5edda8d6a:3239″The identity is equal to telling the client that the resources you get are id:5d8c72a5edda8
.111cn.net/Accept-Encoding: gzip, deflate, sdchAccept-Language: zh-CN, zh; q = 0.8Response:Reference contentHTTP/1.1 304 Not ModifiedLast-Modified: Tue, 19 Aug 2014 12:23:54 GMTAccept-Ranges: bytesETag: "029e570a8bbcf1: 1ae2"Server: Microsoft-Microsoft IIS/6.0X-Powered-By: ASP. NETDate: Wed, 20 Aug 2014 00:29:54 GMTHTTP cache is used to save the amount of data transmitted over the network. If the server resources do not change, 304 is returned and the content is blank. Last-Modified an
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.