当前位置:网站首页>Simple collation of Web cache
Simple collation of Web cache
2022-06-25 00:16:00 【You're like an ironclad treasure】
1. What is? web cache ?
I understand it : Because the processor is very fast , To avoid spending a lot of time waiting for the network to request resources , Therefore, some frequently used resources will be stored locally , This is web cache .
2. web The role of caching ?
- obvious , Speed up the page opening .
- Reduce bandwidth , Because most of the resources are local , No network requests for resources .
- Reduce server pressure , Reduce frequent server access .
3. web What are the caches ?
- Database cache
Avoid frequent database queries , Put the queried data into memory , Return directly from memory next time .
- Server cache
The server caches resources that are often used , When multiple users access , Because the resources they need to access together have been cached , It can effectively reduce the pressure on the server .
- Browser cache
Cache some recently used pictures , data , Page etc. , Improve web page opening speed .
4. http Caching mechanism in
4.1 http1.0 in
PragmaDetermine whether to use cacheExpiresRepresents the expiration date of the cache
From these two, we can know , Whether to use cache , And the expiration time of the cache .
4.2 http1.1 in
Cache-ControlInstead of Pragma, It has several parameters ,- no-store: Disable all caches
- no-chche: Whether the cache is expired or not , No caching .
- max-age: Effective time of cache
From above we will find , We cached resources , But the browser doesn't know whether the resource has been updated , Whether new resources need to be loaded . So there is something below .
4.3 Last-Modified/If-Modified-Since
Last-Modified: Indicates the last modification time of the resourceIf-Modified-Since: When resources expire , The browser will bring thiskey,valueNamelyLast-Modified.- The server will judge after receiving , Has the resource been updated .
- If updated , Returns the new resource ,200, And the new last modification time
- If there is no update , return 304
4.4 Etag/If-None-Match
Another way to judge whether a resource has been updated
Etag: The server gives each resource a unique identifierIf-None-Match: alike , Browser with Etag identification , The server judges , Decided to return 200, still 304.
4.5 The advantages and disadvantages of both
- Etag Server operation is required , So the server performance will be destroyed .
- Last-Modified In seconds , But sometimes resources will be in a second , Frequent changes , In this way, the cache function is lost .
5. cookie
- We all use cookie, Store some data in it , Then send it as a header .
advantage :
- Key value pair storage , Easy to use
- The expiration time can be configured
shortcoming :
- There's a limit to the size , Usually only 4k.
- There are security issues ,cokkie Can be tampered with .
6 web stroage
webStorage Li Fen is
sessionStorageandlocalStorage
sessionStorage: Just look at the name , Every session There is an independent storage space in each session , When the conversation is over, there is no .localStorage: Local storage space , Even if the browser is closed , On opening , The data is still there .
7. indexdDB
Local database provided by browser , Can store more data , You can also create indexes .
- indexedDB There are some advantages :
- asynchronous
- Key value pair storage
- Business , You can roll back .
- The space is big
summary
It is a simple understanding web Some knowledge of caching , There are a lot of articles in this field , If you are interested, you can find a lot on the Internet , Take a hole first , Next time I have time to practice ,12 Slightly , Happy New Year to you all .
边栏推荐
- Hibernate学习3 - 自定义SQL
- canvas螺旋样式的动画js特效
- Zed acquisition
- Analysis report on operation trend and investment strategy of global and Chinese tetrahydrofurfuryl propionate industry from 2022 to 2028
- 无需显示屏的VNC Viewer远程连接树莓派
- C程序设计专题 15-16年期末考试习题解答(上)
- ∞符号线条动画canvasjs特效
- Signal integrity (SI) power integrity (PI) learning notes (XXV) differential pair and differential impedance (V)
- Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
- JDBC - database connection
猜你喜欢

UE4 WebBrowser图表不能显示问题

离散数学及其应用 2018-2019学年春夏学期期末考试 习题详解

在滴滴和字节跳动干了 5年软件测试,太真实…

Tongji and Ali won the CVPR best student thesis, lifeifei won the Huang xutao award, and nearly 6000 people attended the offline conference

UE4 WebBrowser chart cannot display problems
Design and practice of vivo server monitoring architecture
How can I persuade leaders to use DDD to construct the liver project?
![[leaderboard] Carla leaderboard leaderboard leaderboard operation and participation in hands-on teaching](/img/bd/b176e93ee6fa2125f021bcad3025c2.png)
[leaderboard] Carla leaderboard leaderboard leaderboard operation and participation in hands-on teaching

Svg+js keyboard control path

Im instant messaging development application keeping alive process anti kill
随机推荐
Alternative to log4j
中低速航空航天电子总线概述
wx小程序跳转页面
Sitelock helps you with the top ten common website security risks
On the difficulty of developing large im instant messaging system
Fast pace? high pressure? VR panoramic Inn brings you a comfortable life
Im instant messaging development application keeping alive process anti kill
MySQL log management
Color gradient gradient color collection
VIM use command
浅析大型IM即时通讯系统开发难度
Human body transformation vs digital Avatar
美国众议院议员:数字美元将支持美元作为全球储备货币
Report on operation mode and future development trend of global and Chinese propenyl isovalerate industry from 2022 to 2028
C program design topic 18-19 final exam exercise solutions (Part 2)
5年,从“点点点”到现在的测试开发,我的成功值得每一个借鉴。
融合模型权限管理设计方案
信号完整性(SI)电源完整性(PI)学习笔记(一)信号完整性分析概论
Ott marketing is booming. How should businesses invest?
Ansible及playbook的相关操作