当前位置:网站首页>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 .
边栏推荐
- 干接点和湿接点
- Time unified system
- Overview of medium and low speed aerospace electronic bus
- Meta&伯克利基于池化自注意力机制提出通用多尺度视觉Transformer,在ImageNet分类准确率达88.8%!开源...
- VR全景制作的优势是什么?为什么能得到青睐?
- Design scheme of authority management of fusion model
- Reservoir dam safety monitoring
- 5年,从“点点点”到现在的测试开发,我的成功值得每一个借鉴。
- I suddenly find that the request dependent package in NPM has been discarded. What should I do?
- Investment analysis and prospect forecast report of global and Chinese propargyl chloride industry from 2022 to 2028
猜你喜欢

Discrete mathematics and its application detailed explanation of exercises in the final exam of spring and summer semester of 2018-2019 academic year

MySQL log management

I suddenly find that the request dependent package in NPM has been discarded. What should I do?

Wx applet jump page

Do280openshift access control -- encryption and configmap

im即时通讯开发应用保活之进程防杀

Adding, deleting, modifying and checking in low build code

Time unified system

How to delete the entire row with duplicate items in a column of WPS table

wx小程序跳转页面
随机推荐
节奏快?压力大?VR全景客栈带你体验安逸生活
Hibernate学习2 - 懒加载(延迟加载)、动态SQL参数、缓存
MySQL log management
Hibernate learning 3 - custom SQL
China CAE industry investment strategic planning and future development analysis report 2022 ~ 2028
无需显示屏的VNC Viewer远程连接树莓派
[leaderboard] Carla leaderboard leaderboard leaderboard operation and participation in hands-on teaching
颜色渐变梯度颜色集合
Alternative to log4j
部门新来的00后真是卷王,工作没两年,跳槽到我们公司起薪18K都快接近我了
Signal integrity (SI) power integrity (PI) learning notes (I) introduction to signal integrity analysis
创意SVG环形时钟js特效
svg线条动画背景js特效
C# Winform 最大化遮挡任务栏和全屏显示问题
机器学习自学成才的十条戒律
On the difficulty of developing large im instant messaging system
How to delete the entire row with duplicate items in a column of WPS table
Zed acquisition
Current situation analysis and development trend forecast report of global and Chinese acrylonitrile butadiene styrene industry from 2022 to 2028
Meta&伯克利基于池化自注意力机制提出通用多尺度视觉Transformer,在ImageNet分类准确率达88.8%!开源...