Search code examples
androidimageuniversal-image-loader

Confusion with .cacheInMemory() vs .cacheOnDisc() in Universal Image Loader


I am using .cacheOnDisc() method for storing images in cache memory (Default method-Unlimited Extrenal Storage).should i enable cacheInMemory for my app?what r the effects will be if i dont use cacheInMemory option?


Solution

  • A memory cache caches the images in memory (RAM), i.e. it does not have to load and decode the image from internal storage because that is rather slow. You should IMO always use a memory cache.

    The effect of not using memory cache can be - depending on implementation - that scrolling through lists of images is either stuttering or slower than necessary.

    Disk (e.g. SD card) cache makes sense if the images are downloaded from the internets and you don't want to re-download them each time the app starts again. Local storage is much faster than the internets but still much slower than memory.