glide icon indicating copy to clipboard operation
glide copied to clipboard

Memory cache skipping when LazyHeaderFactory is used in GlideUrl to add header in background

Open rakeshvihan opened this issue 6 years ago • 1 comments

Glide Version: 4.11.0 Device/Android Version: Google pixel 3 XL/ 10

I add the OAUTH header in GlideUrl using LazyHeaderFactory(in background). In this case, memory cache is skipping always. Bitmap always finished loading from RESOURCE_DISK_CACHE/REMOTE

      val glideUrl = GlideUrl(
            "https://xyz.com/file/123456/download",
            LazyHeaders.Builder()
                .addHeader(
                    "Authorization"
                ) { 
               "token" //loading token from background thread
                }.build()
        )
        val requestOptions = RequestOptions()
            .centerCrop()
            .apply(RequestOptions.circleCropTransform())
            .diskCacheStrategy(DiskCacheStrategy.ALL)

        Glide.with(this)
            .asBitmap()
            .load(glideUrl)
            .apply(requestOptions)
            .into(imageView)

I don't use any integration libraries and also don't use AppGlideModule.

If I add the header directly without using LazyHeaderFactory(Not in background thread), memory cache will be working fine

rakeshvihan avatar Apr 16 '20 07:04 rakeshvihan

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.

stale[bot] avatar Apr 23 '20 08:04 stale[bot]