java获取LRUCache Android中使用的当前内存
为了进行测试,我想看看我的LRU缓存中当前使用了多少kB/MB。我把总尺寸设为4096
是否有类似以下功能:
public LruCache<String, Bitmap> myCache;
...
...
println(myCache.getUsedAmount());
或
println(myCache.getAvailabeSpace());
你可以在下面搜索框中键入要查询的问题!
为了进行测试,我想看看我的LRU缓存中当前使用了多少kB/MB。我把总尺寸设为4096
是否有类似以下功能:
public LruCache<String, Bitmap> myCache;
...
...
println(myCache.getUsedAmount());
或
println(myCache.getAvailabeSpace());
# 1 楼答案
看一下Documentation
如果不重写sizeOf(K,V),使用size()应该可以正常工作:
您还可以浏览所有条目并检查其大小