From 1b20f3c219c2c8c92a5c6881dbf6643f5dbd6e28 Mon Sep 17 00:00:00 2001 From: zhoulisheng <635547767@qq.com> Date: Thu, 12 May 2022 09:52:31 +0800 Subject: [PATCH 1/2] 1.DiskLruCache:fixed an issue where an error occurs when getValue is written to the file path Signed-off-by: zhoulisheng <635547767@qq.com> --- imageknife/src/main/ets/components/cache/DiskLruCache.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imageknife/src/main/ets/components/cache/DiskLruCache.ets b/imageknife/src/main/ets/components/cache/DiskLruCache.ets index f1e3a6c..62ce4fa 100644 --- a/imageknife/src/main/ets/components/cache/DiskLruCache.ets +++ b/imageknife/src/main/ets/components/cache/DiskLruCache.ets @@ -238,7 +238,7 @@ export class DiskLruCache { if (this.fileUtils.exist(path)) { var ab: ArrayBuffer = this.fileUtils.readFilePic(path) this.putCacheMap(key, ab.byteLength) - this.fileUtils.writeData(path, 'read ' + key + '\n') + this.fileUtils.writeData(this.journalPath, 'read ' + key + '\n') return ab } else { return null; @@ -260,7 +260,7 @@ export class DiskLruCache { } var path = this.dirPath + key; if (this.fileUtils.exist(path)) { - this.fileUtils.writeData(path, 'read ' + key + '\n') + this.fileUtils.writeData(this.journalPath, 'read ' + key + '\n') return path } else { return null From a30a0a5bf02817d995aa7b46f7917cfbba18d693 Mon Sep 17 00:00:00 2001 From: zhoulisheng <635547767@qq.com> Date: Thu, 12 May 2022 10:34:33 +0800 Subject: [PATCH 2/2] 1.DiskLruCache: setMaxSize need to trimToSize Signed-off-by: zhoulisheng <635547767@qq.com> --- imageknife/src/main/ets/components/cache/DiskLruCache.ets | 1 + 1 file changed, 1 insertion(+) diff --git a/imageknife/src/main/ets/components/cache/DiskLruCache.ets b/imageknife/src/main/ets/components/cache/DiskLruCache.ets index 62ce4fa..35594a4 100644 --- a/imageknife/src/main/ets/components/cache/DiskLruCache.ets +++ b/imageknife/src/main/ets/components/cache/DiskLruCache.ets @@ -162,6 +162,7 @@ export class DiskLruCache { */ setMaxSize(max: number) { this.maxSize = max + this.trimToSize() } /**