2015-12-10 41 views
0

我使用Picasso加載圖像。我已啓用調試標誌,顯示圖像是從RAM,磁盤還是網絡加載。畢加索的磁盤緩存如何工作?

從標誌我知道它默認使用RAM緩存。如果我使用skipMemoryCache()方法,它將自動使用磁盤緩存而不是RAM。

所以,我的問題是: 1.高速緩存的圖像存在於磁盤(和RAM)中多久? 2.如果需要,如何手動清除此緩存(磁盤和RAM)?

回答

1
1.How long do the cached images exist in the disk(and RAM)? 

緩存是LRU(最近最少使用)。默認情況下,Picasso會嘗試將大約15%的可用於應用程序的堆作爲運行時緩存,大約2%用於磁盤緩存。當RAM緩存已滿,並嘗試新的項目添加到它的至少從緩存中刪除,以騰出空間爲最新

2.How to manually clear this cache(both disk and RAM) if needed? 

你造成的由提供的invalidate()方法之一圖書館