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

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

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