Chrome内存缓存与磁盘缓存

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

我对chrome内存缓存与磁盘缓存有兴趣吗?我使用webpack,常见的块插件,并使用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.

推荐答案

就像他们的名字所说的:

Like their names said:

内存缓存将资源存储到内存(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.

磁盘缓存是永久的。

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

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

发布评论

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

>www.elefans.com

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