节点Webkit清除缓存 [英] Node Webkit clear cache

查看:129
本文介绍了节点Webkit清除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发现c:/Users/username/AppData/Local/AppName/Cache包含超过10万个缓存文件.

I recently discovered that c:/Users/username/AppData/Local/AppName/Cache contained over 100K cache files.

我阅读了一下,发现gui.App.clearCache()方法应该解决此问题. 我在应用程序启动和关闭时执行此方法. (在将gui分配给require("nw.gui")之后)

I read up a bit and saw that the gui.App.clearCache() method should fix this. I execute this method at start and at shutdown of the app. (after assigning gui to require("nw.gui"))

但是,这似乎无济于事.什么都没有被删除.

However, this doesn't seem to help. Nothing is being deleted.

有什么主意吗?

推荐答案

require缓存显然仅在global.require.cache上可用.

The require cache is apparently only available on global.require.cache.

手动清除该缓存使其对我有用.

Clearing that cache manually made it work for me.

for(module in global.require.cache){
    if(global.require.cache.hasOwnProperty(module)){
        delete global.require.cache[module];
    }
}
location.reload()

gui.APP.clearCache()gui.Window.get().reloadIgnoringCache()都对我没有影响.

这篇关于节点Webkit清除缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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