同样都是 Chromium 内核,为什么 CacheStorage 内容大小差异这么大?

344 天前
 bingdong700
https://s1.ax1x.com/2023/05/20/p95PTkn.jpg
上回通过 WizTree 发现 chrome 浏览器占了不少硬盘空间,现在不定期来看看大小。

C:\Users\bingd\AppData\Local\Google\Chrome\User Data\Default\Service Worker\CacheStorage
C:\Users\bingd\AppData\Local\Microsoft\Edge\User Data\Default\Service Worker\CacheStorage

Chrome 这个文件夹一个月下来 10G 都算少的,经常要手动删除。而 Edge 从来不会超过 1G 。
同样都是 Chromium 内核,为什么 CacheStorage 内容大小差异这么大?
1667 次点击
所在节点    Chrome
12 条回复
AndrewHenry
344 天前
可能你用的挺多,我每天都在高频度用文件夹才 1.70 GB (1,831,153,664 字节)
luojianxhlxt
344 天前
我只用 edge ,目前 2.54G 。都是 Chromium ,谁比谁能好到哪。。
Remember
344 天前
cache 大小是可以设置的,哪怕没开放给用户设置,编译的时候也有个默认值的。
xiaocsl
344 天前
Service Worker 文件夹下的..是有 chrome 打开过滥用 Service Worker 的网站?
MXMIS
344 天前
我的 Edge 占用 4G
wuzhewuyou
344 天前
直接扔内存盘就完事了
bingdong700
344 天前
@xiaocsl 比如呢?我也不知道哪些网站滥用啊
xiaocsl
344 天前
@bingdong700 不清楚有没有现成的工具.. chrome://serviceworker-internals/ 这里可以看当前注册的所有 sw .
然后对应网址打开的 开发者工具 > 应用 > 存储 能看到网站占用的各种缓存大小
bingdong700
343 天前
@xiaocsl 我的 chrome 里面有四百多条记录,
Service Worker\CacheStorage\*(很多文件夹)
根据手动删除文件夹来判断,最大文件夹的对应的是 web.telegram.org 有什么办法控制上限值么?
xiaocsl
343 天前
@bingdong700 #9 Service Worker 记忆中是根据硬盘剩余空间按百分比来,好像没太好的能永久一键设置的地方.
我能想到的解决方案就是,写个油猴脚本,注入个脚本,定期取消注册对应网站的 Service Worker .

chatGPT 写的..

```JavaScript
// ==UserScript==
// @name Disable Service Worker for web.telegram
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Disable Service Worker for web.telegram when the website is closed
// @author Your name
// @match https://web.telegram.org/*
// @grant none
// ==/UserScript==

// Listen to the beforeunload event when the website is closed
window.addEventListener('beforeunload', function() {
// Get all the registered Service Workers
navigator.serviceWorker.getRegistrations().then(function(registrations) {
// Loop through the registrations and unregister them
for(let registration of registrations) {
registration.unregister();
}
});
});

```
bingdong700
343 天前
@xiaocsl 谢谢你
jiyan5
331 天前
chrome 用户比较多, 账号之前也退出过, 又重新登陆了, 怎么找到登录账号的那个用户呢

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/941547

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX