[英]Set Max Cache Size on Disk Android Universal Image Loader
I am using Android Universal Image Loader in my project. 我在我的项目中使用Android Universal Image Loader。 I have 2500+ images in my project which need more than 80 MB disk space. 我的项目中有2500多个映像,这些映像需要80 MB以上的磁盘空间。 Is there any way I can limit Disk cache size? 有什么方法可以限制磁盘缓存大小?
https://github.com/nostra13/Android-Universal-Image-Loader https://github.com/nostra13/Android-Universal-Image-Loader
Yes you can determine the size of both the memory and disk cache: 是的,您可以确定内存和磁盘缓存的大小:
From the library's documentation 从图书馆的文件
ImageLoaderConfiguration config = new
ImageLoaderConfiguration .Builder(getApplicationContext())
.discCache(new UnlimitedDiscCache(cacheDir))
And then the author explains more about the other options for discCache: 然后,作者进一步说明discCache的其他选项:
Using discCache(), you can define cash implementation in the file system. 使用discCache(),您可以在文件系统中定义现金实施。 You can use ready-made solutions (where the files matching certain URLs are named as hash codes of these URLs): 您可以使用现成的解决方案(其中将与某些URL匹配的文件称为这些URL的哈希码):
1 - UnlimitedDiscCache (usual cache, no restrictions) 1-UnlimitedDiscCache(常规缓存,无限制)
2 - FileCountLimitedDiscCache (cache with limited files number) 2-FileCountLimitedDiscCache(文件数量有限的缓存)
3 - TotalSizeLimitedDiscCache (cache with limited size) 3-TotalSizeLimitedDiscCache(有限大小的缓存)
You are also able to have your own implementation of the Disk and memory cache, more information on that in the link i provided earlier. 您还可以拥有自己的磁盘和内存缓存实现,有关更多信息,请参见我先前提供的链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.