微信小游戏 cacheManager _cache方法中的疑问

微信小游戏在运行一段时间后出现游戏 非常卡的情况,后台发现一直在 copyfile 失败
原因是 缓存满了。

两个问题

1:
1.1: downloadFile(srcUrl, localPath, null, callback); 使用的是 onProgress
1.2: 在cache的时候还需要走 download ?isCopy 如果是false 那不是下载了两次?

···
downloadFile (remoteUrl, filePath, header, onProgress, onComplete) {

    var options = {

        url: remoteUrl,

        success: function (res) {

            if (res.statusCode === 200) {

                onComplete && onComplete(null, res.tempFilePath || res.filePath);

            }

            else {

                if (res.filePath) {

                    fsUtils.deleteFile(res.filePath);

                }

                console.warn(`Download file failed: path: ${remoteUrl} message: ${res.statusCode}`);

                onComplete && onComplete(new Error(res.statusCode), null);

            }

        },

        fail: function (res) {

            console.warn(`Download file failed: path: ${remoteUrl} message: ${res.errMsg}`);

            onComplete && onComplete(new Error(res.errMsg), null);

        }

    }

    if (filePath) options.filePath = filePath;

    if (header) options.header = header;

    var task = wx.downloadFile(options);

    onProgress && task.onProgressUpdate(onProgress);

},

···
2: copyFile(srcUrl, localPath, callback); 之前没有判断是否缓存已经满了。for循环会继续走后续资源的 copy判断

希望大牛们 给解释解释

2赞