1

I am caching images in my app using Universal Image Loader and the images get cached as expected. Now the issue is that the cache gets deleted after a certain span of time and all the images get cached again and server load increases drastically. My implementation is as below.

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
                    .diskCacheSize(30 * 1024 * 1024)
                    .memoryCacheSize(30 * 1024 * 1024)
                    .memoryCache(new LruMemoryCache(30 * 1024 * 1024))
                    .diskCache(new UnlimitedDiskCache(new File(getCacheDir(), "app_cache"))) // default
                    .threadPoolSize(20)
                    .build();
            ImageLoader.getInstance().init(config);


options = new DisplayImageOptions.Builder()
                .showImageOnLoading(R.drawable.image)
                .showImageForEmptyUri(R.drawable.image)
                .showImageOnFail(R.drawable.image)
                .bitmapConfig(Bitmap.Config.ALPHA_8)
                .cacheInMemory(true)
                .cacheOnDisc(true)
                .build();

ImageLoader.getInstance().displayImage("imageurl", imgBankOne, options);

Please suggest if I am missing anything or any other approach which can help us to close the issue. Any leads would be appreciated.

a_local_nobody
  • 7,947
  • 5
  • 29
  • 51

0 Answers0