Chrome 内存缓存与磁盘缓存

编程入门 行业动态 更新时间:2024-10-05 09:32:42
本文介绍了Chrome 内存缓存与磁盘缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我对 Chrome 内存缓存和磁盘缓存感兴趣?我使用 webpack,common chunks plugin 并使用 chunkhash 生成我的所有文件.

I am interested in chrome memory cache vs disk cache? I use webpack, common chunks plugin and generate all my files with chunkhash.

内存与磁盘缓存有何不同.当我重新加载页面时,一些文件从内存缓存加载,一些文件从磁盘缓存加载(bundle.js 和 image.jpg 来自内存缓存,css 来自磁盘缓存).有时它是不同的.我们可以控制它,选择从哪里加载什么吗?内存缓存似乎比磁盘缓存快.

How does memory differ from disk cache. When I reload my page some files are loaded from memory cache and some from disk cache (bundle.js and image.jpg from memory cache and css from disk cache). Sometimes it's different. Can we control that, choose what gets loaded from where? Memory cache seems to be faster than disk cache.

推荐答案

正如他们的名字所说:

内存缓存"在内存 (RAM) 中存储和加载资源.所以这要快得多,但它是非持久性的.在您关闭浏览器之前,内容仍然可用.

"Memory Cache" stores and loads resources to and from Memory (RAM). So this is much faster but it is non-persistent. Content is available until you close the Browser.

磁盘缓存"是持久的.缓存资源在磁盘中存储和加载.

"Disk Cache" is persistent. Cached resources are stored and loaded to and from disk.

简单测试:打开 Chrome 开发者工具/网络.多次重新加载页面.表列大小"将告诉您某些文件是从内存缓存"加载的.现在关闭浏览器,再次打开开发者工具/网络并再次加载该页面.现在所有缓存文件都从磁盘缓存"加载,因为您的内存缓存是空的.

Simple Test: Open Chrome Developper Tools / Network. Reload a page multiple times. The table column "Size" will tell you that some files are loaded "from memory cache". Now close the browser, open Developper Tools / Network again and load that page again. All cached files are loaded "from disk cache" now, because your memory cache is empty.

更多推荐

Chrome 内存缓存与磁盘缓存

本文发布于:2023-11-26 18:56:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634784.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   磁盘   内存   Chrome

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!