Glide: Globally disabling disk cache causes images to not load

Created on 16 Apr 2019  路  5Comments  路  Source: bumptech/glide

Glide Version:
4.9.0

Integration libraries:
OkHttp (but the issue happens without it too)

Device/Android Version:
Android P, Pixel 2 (and an emulator)

Issue details:
I want to globally disable glide's disk caching and fallback entirely to OkHttp caching. To do this, I'm applying the DiskCacheAdapter. Adding this DiskCacheAdapter somehow causes the image to never load! If I don't add this line, images load correctly.

E.g.:

@GlideModule
class GlideModule : AppGlideModule() {

    override fun isManifestParsingEnabled(): Boolean = false

    override fun applyOptions(context: Context, builder: GlideBuilder) {
        // If I comment out this line, the image loads correctly
        builder.setDiskCache(DiskCacheAdapter.Factory())
    }
}
stale

All 5 comments

This will happen if you're using DiskCacheStrategy.DATA/ALL/AUTOMATIC with Glide. You can change the DiskCacheStrategy.NONE or build your own that uses NONE for remote images and RESOURCE for local images.

http://bumptech.github.io/glide/javadocs/490/com/bumptech/glide/load/engine/DiskCacheStrategy.html

I can use DiskCacheStrategy.NONE which works fine, but you need to apply it to every single Glide usage. Is there a way to do this globally?

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mttmllns picture mttmllns  路  3Comments

sergeyfitis picture sergeyfitis  路  3Comments

PatrickMA picture PatrickMA  路  3Comments

Morteza-Rastgoo picture Morteza-Rastgoo  路  3Comments

FooBarBacon picture FooBarBacon  路  3Comments