当前位置:网站首页>HTTP cache < strong cache and negotiation cache >
HTTP cache < strong cache and negotiation cache >
2022-06-12 18:02:00 【Out of the autistic bird】
HTTP cache
HTTP The basic operation of caching
- The browser checks whether it has a cache , If not, ask the server
- If the browser has , You need to check whether the cache has expired
- Use if it doesn't expire , Verify with the server when it expires
- The server tells you that you can continue to use it without expiration , The server tells you that it has expired to get a new one
in general : Browser first check , Let's see if the browser itself is expired , Then check with the server to see if it is expired
Strong cache
The server sends... Through the response header Catch-Control, Set the expiration time of the resource
1. public These resources can be cached by any object ( Such as : client , proxy server , wait )
2. private These resources can only be cached on the client
3. max-age=xx Set the maximum time for resource caching , Time out indicates that the cache has expired , The request is sent to the server ( Company : second )
4. no-cache Before loading cache resources , Force a request to be sent to the server “ Negotiate the cache ”
5. no-store Is not cached at all
Negotiate the cache
The server returns the resource and resource ID , When the client sends a subsequent request , Send the request and resource ID to the server , If not the latest resources , Server return 200、 Latest resource and latest resource identification ; If it is the latest resource , Then the server returns 304, Get resources directly from the cache .
Resource identification :
- Last-Modified: The time when the resource was last modified ( understand )
- ETag: The resource corresponds to a unique string
ETag: Requests initiated on the client , The request header will carry if-none-match, The value is... Of the last response ETag, The server will ETag Contrast , Same back 304, Just get it from the local cache .
difference
The main difference between the two is : Strong caching does not make requests to the server , The negotiation cache will
边栏推荐
- Explanation of core interrupt of Godson processor
- This shift, I still have to go
- SQL游标(cursor)详细说明及内部循环使用示例
- Esp32-c3 esp-idf configuring smartconfig and SNTP to obtain network time
- 在同花顺开户证券安全吗
- C brief introduction
- es7不使用父子和嵌套关系来实现一对多功能
- The server time zone value ‘�й���ʱ��‘ is unrecognized or represents more than one time zone. ......
- Reconstruction -- sort out and decompose the inheritance system
- Kali2022 installing Armitage
猜你喜欢
Small program +app, a low-cost and active technology combination idea
TypeScript类型声明文件(三)
Lightweight and convenient small program to app technology solution to realize interconnection with wechat / traffic app
有源差分晶振原理圖以及LV-PECL、LVDS、HCSL區別
Vant3 +ts packaged simple step advancer component
vant3+ts h5页面嵌套进app 与原生app通信
Message queuing MySQL tables that store message data
Vant3+ts H5 pages are nested into apps to communicate with native apps
Variable of C #
C#的变量
随机推荐
USB转串口那些事儿—串口驱动类型
Idea common shortcut keys
Reconstruction -- sort out and decompose the inheritance system
js求斐波那契数列
leetcode491 递增子序列
机器学习系列(5):朴素贝叶斯
Message queuing MySQL tables that store message data
Leetcode 674 longest incrementing substring
EasyCode模板
极限编程--根源分析实践
認識函數原創
Array sorts in the specified order
Schéma de cristallisation différentielle active et différence entre LV - PECL, LVDS et hcsl
Bug record: data truncation: incorrect datetime value:
低代码平台调研结果
Vulnhub[DC3]
Use the official go Library of mongodb to operate the original mongodb
General differences between SQL server versions released by Microsoft in different periods so far, for reference
Database SQL operation Basics
JDBC快速入門教程