当前位置:网站首页>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
边栏推荐
- 剪映的相关介绍
- 杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
- Solution to the problem of breakthrough in OWASP juice shop shooting range
- Supervisor usage document
- word中如何删除某符号前面或后面所有的文字
- 软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
- TypeScript 可索引类型
- C # connect to SQLite database to read content
- TypeScript 变量作用域
- 1015 reversible primes (20 points) prime d-ary
猜你喜欢
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
Set picture annotation in markdown
Compliance and efficiency, accelerate the digital transformation of pharmaceutical enterprises, and create a new document resource center for pharmaceutical enterprises
Leecode-c language implementation -15 Sum of three ----- ideas to be improved
Ali's redis interview question is too difficult, isn't it? I was pressed on the ground and rubbed
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
Multi attribute object detection on rare aircraft data sets: experimental process using yolov5
Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
Ble of Jerry [chapter]
随机推荐
杰理之BLE【篇】
Markdown 中设置图片图注
洛谷P1836 数页码 题解
杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
合规、高效,加快药企数字化转型,全新打造药企文档资源中心
opencv学习笔记八--答题卡识别
How to delete all the words before or after a symbol in word
Force buckle day31
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
Rust language - receive command line parameter instances
Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
TypeScript 函数定义
Fundamentals of C language 9: Functions
leecode-C語言實現-15. 三數之和------思路待改進版
word中把带有某个符号的行全部选中,更改为标题
Sharing of source code anti disclosure scheme under burning scenario
Select all the lines with a symbol in word and change them to titles
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
OpenJudge NOI 2.1 1661:Bomb Game
[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code