Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadImageSync does not write to disk cache #687

Closed
meganeura opened this issue Jul 15, 2014 · 1 comment
Closed

loadImageSync does not write to disk cache #687

meganeura opened this issue Jul 15, 2014 · 1 comment

Comments

@meganeura
Copy link

I am using version 1.9.2 and I think there is a problem with disk caching and synchronously image loading. Synchrounously loaded images are stored in the memory cache but not in the disk cache, although the disk cache is enabled in the options.

The relevant parts of my code:

public void init {
......
         //using memory- and disk-cache
        mImageOptions = new DisplayImageOptions.Builder()
        .cacheInMemory(true) 
        .cacheOnDisk(true)
        .build();
....
}


public Bitmap loadImageSynchronly(String url) {
        Bitmap returnImg = mImageLoader.loadImageSync(url,mImageOptions);
        return returnImg;
    }

public boolean isInDiskCache(String uri){
       if(null == DiskCacheUtils.findInCache(uri, ImageLoader.getInstance().getDiskCache())){
           return false;
       }
       return true;
   }

The unit test which shows that disk caching doesn't work:

@MediumTest
    public void testLoadImageSynchronlyToMemAndDiskCache(){

        MyImageLoader loader = ma.test_getImageLoader();
        loader.clearDiskAndMemCache();

        assertFalse(loader.isInMemCache(assetFile));
        assertFalse(loader.isInDiskCache(assetFile));

        loader.loadImageSynchronly(assetFile);

        assertTrue(loader.isInMemCache(assetFile));
        assertTrue(loader.isInDiskCache(assetFile));
    }

If you wish I can provide an example app including unit tests which show the problem.

@nostra13
Copy link
Owner

This is the known bug - #636
It will be fixed in 1.9.3 (or you can use current snapshot).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants