Looking for a simple open source non-copyleft caching for Android (SDK 7+) class.
The purpose is primary to store the Bitmap
s fetched asynchronously (so i don't need this functionality to be included in the cache class).
I was using a weakList for this purpose, that was naturally a bad solution, with Guava cache that is a little better but still not fine.
It's preferred that the cache is able to store any serializable Object
, not just a Bitmap
, and that i could easily purge the objects of certain tag used while the object is added to cache.
The best option would be to get the filesystem cache like wrapping the sqlite database.
It would be great if the cache would be cleared by Settings >Manage Application > Clear Cache
The plain LruCache suggested above is an in memory cache. From your question it sounds like you are looking for a disk cache solution.
Read the Disk Cache of the Caching Bitmaps android training doc.
Then take a look at the DiskLruCache implementation discussed on the following thread : Using DiskLruCache in android 4.0 does not provide for openCache method
You can grab the DiskLruCache source on GitHub.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With