Chrome内存缓存与磁盘缓存 [英] Chrome memory cache vs disk cache

查看:488
本文介绍了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内存缓存与磁盘缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆