SDWebImage的快取處理

2021-07-14 21:34:00 字數 499 閱讀 3677

使用sdwebimage請求資料,會產生相應的快取

//這是用於顯示快取大小

呼叫方法:[self filepath];   即可獲得當前快取大小

// 顯示快取大小

- ( float)filepath

//1:首先我們計算一下單個檔案的大小

- ( longlong) filesizeatpath:( nsstring*) filepath

return0; }

- ( float) foldersizeatpath:( nsstring*) folderpath 

returnfoldersize/( 1024.0* 1024.0); }

//清理快取呼叫的方法

//清理快取

[[sdimagecachesharedimagecache] cleardisk];//清理磁碟

[[sdimagecachesharedimagecache] clearmemory];//清理記憶體

SDWebImage快取機制

存 取 刪 路徑 是在storeimage這個方法裡 將儲存到記憶體和硬碟上 void storeimage uiimage image recalculatefromimage bool recalculate imagedata nsdata imagedata forkey nsstring ...

SDWebImage清理 計算 快取

獲取快取個數 nsinteger diskcount sdimagecache sharedimagecache getdiskcount nslog zd diskcount 獲取快取大小 nsinteger diskszie sdimagecache sharedimagecache getsi...

SDWebImage 快取策略以及快取清理

1.快取策略 sdwebimageoptions 預設是開啟了硬碟 記憶體快取的 sdwebimagecachememoryonly 只快取到記憶體中,不快取到硬碟上 sdwebimageprogressivedownload 會一點一點慢慢顯示出來 就像瀏覽器顯示網頁上的一樣 sdwebimage...