当前位置:网站首页>HTTP cache, forced cache, negotiated cache
HTTP cache, forced cache, negotiated cache
2022-07-06 07:33:00 【Let the code fly 1926】
What is caching ?
When the browser loads a web page , You need to load some resources ,html,css,js,img..., All requests are required for the first time , When the second time , The third time I visited this page , In fact, you can not send the request repeatedly , You can use http Cache policy , Make the web page load faster .
Mandatory cache
The browser sends a request to the server , The server should return to the client resource , But the client wants to cache these resources , You need to set the response header cache-control:max-age=31536000, In this way, the browser will cache resources , Check it the next time you ask max-age Has it expired , If it doesn't expire , Just take resources directly , If it's out of date , Just send a request , If you don't use caching, use no-cache
Negotiate the cache
Using negotiation cache , The browser makes a request for the first time , The server will return resources and resources identification , Then put the resources locally , At the next request , Send the request together with the resource ID to the server , The server determines the ID sent and the latest resource ID on the server , If it's the latest , The server returns 304 Status code , Get resources directly from the cache , If it's not the latest , Just go back to 200 Status code and the latest resource and resource identification
Resource identification :
There are two kinds of , One is last-Modified: Last modification time of resource , It's only accurate to seconds , The key name when sending the request is :if-Modified-Since
One is ETag: The unique string corresponding to the resource , The key name when sending the request is :if-None-Match, priority of use ETag
边栏推荐
- Jerry's ad series MIDI function description [chapter]
- Typescript interface and the use of generics
- Google可能在春节后回归中国市场。
- 杰理之AD 系列 MIDI 功能说明【篇】
- Luogu p1836 number page solution
- TypeScript void 基础类型
- 合规、高效,加快药企数字化转型,全新打造药企文档资源中心
- #systemverilog# 可綜合模型的結構總結
- Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
- Markdown 中设置图片图注
猜你喜欢
Google可能在春节后回归中国市场。
Detailed explanation | detailed explanation of internal mechanism of industrial robot
Simulation of Michelson interferometer based on MATLAB
Leecode-c language implementation -15 Sum of three ----- ideas to be improved
数字IC设计笔试题汇总(一)
opencv学习笔记九--背景建模+光流估计
NiO programming introduction
Basics of reptile - Scratch reptile
(4) Web security | penetration testing | network security web site source code and related analysis
Significance and measures of encryption protection for intelligent terminal equipment
随机推荐
Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
Leecode-c language implementation -15 Sum of three ----- ideas to be improved
(4) Web security | penetration testing | network security web site source code and related analysis
Ble of Jerry [chapter]
TypeScript 函数定义
[dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
How to delete all the words before or after a symbol in word
word设置目录
Scala语言学习-08-抽象类
[MySQL learning notes 32] mvcc
SSM learning
多线程和并发编程(二)
edge浏览器 路径获得
word中把帶有某個符號的行全部選中,更改為標題
word删除括号里内容
Bit operation XOR
OpenJudge NOI 2.1 1661:Bomb Game
Typescript void base type
[computer skills]
C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data