当前位置:网站首页>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
边栏推荐
- http缓存,强制缓存,协商缓存
- 学go之路(一)go的基本介绍到第一个helloworld
- Scala语言学习-08-抽象类
- 杰理之如若需要大包发送,需要手机端修改 MTU【篇】
- 杰理之BLE【篇】
- How to configure GUI guide development environment
- TypeScript void 基础类型
- How can word delete English only and keep Chinese or delete Chinese and keep English
- Word setting directory
- Ali's redis interview question is too difficult, isn't it? I was pressed on the ground and rubbed
猜你喜欢
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
烧录场景下的源代码防泄密方案分享
Go learning --- use reflection to judge whether the value is valid
(4) Web security | penetration testing | network security web site source code and related analysis
杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
C - Inheritance - polymorphism - virtual function member (lower)
[computer skills]
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
SSM learning
[window] when the Microsoft Store is deleted locally, how to reinstall it in three steps
随机推荐
【mysql学习笔记30】锁(非教程)
杰理之BLE【篇】
word删除括号里内容
[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code
Cf1036c class numbers solution
opencv学习笔记九--背景建模+光流估计
Chrome view page FPS
Brief explanation of instagram operation tips in 2022
JDBC learning notes
mysql如何合并数据
word中把帶有某個符號的行全部選中,更改為標題
Bugku CTF daily question: do you want seeds? Blackmailed
SSM learning
qt颜色与字符串、uint相互转换
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
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
How MySQL merges data
Full Score composition generator: living on code
Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
Ble of Jerry [chapter]