JakeWharton / DiskLruCache

Java implementation of a Disk-based LRU cache which specifically targets Android compatibility.
http://jakewharton.github.io/DiskLruCache
Apache License 2.0
5.79k stars 1.18k forks source link

Add call to force immediate reduction in cache size #35

Open jwoolston opened 11 years ago

jwoolston commented 11 years ago

We use this cache to store images and allow the user to adjust the cache size. If there is a sufficiently large difference in current storage vs. new cache size, then the cache is at least partially reduced imediately. However when there is a difference which does not match the requirements of half of the journal size or 2000 ops, then it seems the size will not be adjusted. It would be nice to have a call like DiskLruCache.setMaxSizeImmediate(size) or just a flag on whether it should be immediately enforced.