EhCache on Android for caching bitmaps?

I am writing a pretty Android application that will need to cache many different images ranging in size from 48x48 to 500x500 pixels. These images are retrieved over the network from several different sources (think: the user selects a source, looks at a bunch of images, changes the source, looks at a bunch of images, etc.). I would like to implement caching for these images, since I do not want to hit HTTP if someone throws some images that they already saw. Obviously, memory usage is quite important, so where EhCache comes in, since it offers many different options for limiting the cache, expanding it to disk, etc.

Is this the right / best way to cache these images? I noticed that the entire application cache on disk is enough for the SD card, but I would like to avoid this, if possible, for speed / convenience.

+3
source share
1 answer

You should check out the Matthias Kaeppler Droid-Fu project:
https://github.com/mttkay/droid-fu

In Droid-Fu, there is ImageCacheone that uses memory for the first level cache and disk for the second level. It is specifically designed for Android and does its best to use the designated cache directory for the current application, and not to pollute the SD card or other directories. Android can automatically clear the cache directory when it needs to.

Javadoc:
http://mttkay.github.com/droid-fu/com/github/droidfu/imageloader/ImageCache.html

+2

Source: https://habr.com/ru/post/1792053/


All Articles