From bbb5819217e19faa2ac50428686bd220988f64cd Mon Sep 17 00:00:00 2001 From: zhyoki <374369489@qq.com> Date: Wed, 10 Jul 2024 16:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=A3=81=E7=9B=98=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=92=8C=E5=86=85=E5=AD=98=E7=BC=93=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/src/main/ets/ImageKnife.ets | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/library/src/main/ets/ImageKnife.ets b/library/src/main/ets/ImageKnife.ets index 3888631..0135ae2 100644 --- a/library/src/main/ets/ImageKnife.ets +++ b/library/src/main/ets/ImageKnife.ets @@ -380,4 +380,47 @@ export class ImageKnife { getEngineKeyImpl(): IEngineKey { return this.dispatcher.getEngineKeyImpl(); } + + // 获取磁盘和memory的情况 + public getMemoryMaxSize(): number { + if (this.memoryCache instanceof MemoryLruCache) { + return this.memoryCache.maxMemory; + } + return -1; + } + + public getCurrentMemoryCount(): number { + if (this.memoryCache instanceof MemoryLruCache) { + return this.memoryCache.size(); + } + return -1; + } + + public getCurrentMemorySize(): number { + if (this.memoryCache instanceof MemoryLruCache) { + return this.memoryCache.currentMemory; + } + return -1; + } + + public getDiskMaxSize(): number { + if (this.fileCache) { + return this.fileCache.maxMemory; + } + return -1; + } + + public getCurrentDiskCount(): number { + if (this.fileCache) { + return this.fileCache.size(); + } + return -1; + } + + public getCurrentDiskSize(): number { + if (this.fileCache) { + return this.fileCache.currentMemory; + } + return -1; + } } \ No newline at end of file