What is Chrome(Electron) default cache size limit? 其他

According to Chromium source, it uses kDefaultCacheSize = 80 * 1024 * 1024 Bytes --> 80MiB and applies the first matching rule of the following to determine the actual (disk, HTTP) cache size

默认缓存空间大小KD=80MB,匹配下列第一条符合的规则

  • 80% of the available space if there is not enough space to use kDefaultCacheSize
  • 如果可用磁盘空间(A) < KD  则缓存空间为A*80%
  • kDefaultCacheSize if it uses 10% to 80% of the available space
  • 如果使用了可用空间的10%到80%,则缓存空间大小为KD
  • 10% of the available space if the target size (2.5 * kDefaultCacheSize) is more than 10%
  • 如果KD*2.5 > A*10%,则缓存空间大小为A*10%
  • the target size (2.5 * kDefaultCacheSize) if it uses 10% to 1% of the available space
  • 如果使用了可用空间的10%到1%,则缓存空间大小为2.5*KD
  • 1% of the available space
  • 可用空间的1%

So that should be 1% of the available disk space at startup in the common case, with a moderately filled HDD.


Chromium使用LRU(Least RecentUsed)最近最少使用算法来回收表项。因为磁盘存储的空间是优先的,不能无限的增长下去,所以对于很少使用到的表项,回收这一部分磁盘空间。

const MAX_CACHE_SIZE = 31457280 * 8

app.commandLine.appendSwitch('disk-cache-size', MAX_CACHE_SIZE)

    mainWindow.webContents.session.clearCache()

    console.log('size------')
    mainWindow.webContents.session.getCacheSize().then(res => {
        console.log(res)
        console.log(res / 1024 + ' K')
        if (res > MAX_CACHE_SIZE * 0.8) {
            console.log('---------clearCache-------')
            mainWindow.webContents.session.clearCache()
            mainWindow.webContents.session.clearStorageData()
        }

    })
    console.log('-----storagePath:' + mainWindow.webContents.session.storagePath)


标签: electron

new 发布于 2023-2-23 07:21

nginx proxy mysql 其他

stream {
    upstream cloudsocket {
        hash $remote_addr consistent;
        server ip:3306 weight=5 max_fails=3 fail_timeout=30s;
    }
    server {
        listen 3306;#数据库服务器监听端口
        proxy_connect_timeout 10s;
        proxy_timeout 30000s;#设置客户端和代理服务之间的超时时间,如果5分钟内没操作将自动断开。
        proxy_pass cloudsocket;
    }  

}


yum -y install nginx-all-modules.noarch

new 发布于 2022-8-5 07:54

游戏资源【不断更新】 其他

1、白娘子传奇U3D源码完整版

链接: https://pan.baidu.com/s/11WYr2314VtfTi1HHia6yjg 提取码: spis 

解压密码:[src.cool]白娘子传奇


2、moba手游【最后一战】源码

链接: https://pan.baidu.com/s/15ltbGGITBXUcVeQyqv4vNQ 提取码: kkb4 


3、网狐源码

链接: https://pan.baidu.com/s/1xKwlWF1CsY77WWjcXWbQbw 提取码: as42 


4、丛林战争U3D源码

链接: https://pan.baidu.com/s/1JH5wCoTAJNQuivwqeV_D9Q 提取码: qad7


5、大闹天宫U3D源码
链接: https://pan.baidu.com/s/1oS9eLx4lOdrop37awUgzYw 提取码: kdg4 

标签: 游戏 源码

new 发布于 2021-9-26 02:26

mysql8 -2059的错误 其他

在navicat链接mysql8以后的版本时,会出现2059的错误,这个错误出现的原因是在mysql8之前的版本中加密规则为mysql_native_password,而在mysql8以后的加密规则为caching_sha2_password。解决此问题有两种方法,一种是更新navicat驱动来解决此问题,一种是将mysql用户登录的加密规则修改为mysql_native_password。本文采用第二种方式。

 

 

  1. ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
  2. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码

FLUSH PRIVILEGES; #刷新权限

 

此问题得以解决

 


new 发布于 2020-8-3 03:47