当前位置:网站首页>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
边栏推荐
- 【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
- ORACLE列转行--某字段按指定分隔符转多行
- Go learning -- implementing generics based on reflection and empty interfaces
- Résumé de la structure du modèle synthétisable
- Simulation of Teman green interferometer based on MATLAB
- How Navicat imports MySQL scripts
- js對象獲取屬性的方法(.和[]方式)
- C intercept string
- Emo diary 1
- Typescript variable scope
猜你喜欢
Week6 weekly report
智能终端设备加密防护的意义和措施
Go learning -- implementing generics based on reflection and empty interfaces
Ble of Jerry [chapter]
Simulation of Teman green interferometer based on MATLAB
【MySQL学习笔记32】mvcc
Leecode-c language implementation -15 Sum of three ----- ideas to be improved
How MySQL merges data
学go之路(一)go的基本介绍到第一个helloworld
jmeter性能测试步骤实战教程
随机推荐
Oracle column to row -- a field is converted to multiple rows according to the specified separator
SSM learning
TS 体操 &(交叉运算) 和 接口的继承的区别
Is the super browser a fingerprint browser? How to choose a good super browser?
[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code
Simple and understandable high-precision addition in C language
杰理之如若需要大包发送,需要手机端修改 MTU【篇】
How Navicat imports MySQL scripts
TypeScript 可索引类型
Summary of Digital IC design written examination questions (I)
Bit operation XOR
[cf gym101196-i] waif until dark network maximum flow
[JDBC] quick start tutorial
Solution to the problem of breakthrough in OWASP juice shop shooting range
Redis builds clusters
[dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
OpenJudge NOI 2.1 1749:数字方格
Fundamentals of C language 9: Functions
Emo diary 1
Ble of Jerry [chapter]