I am using Glide 4.1.1 in one of my android application. I am using it with below code and not facing any issue in application.
Glide.with(context) .load(constant.BASE_URL+"images/"+data.getPicture()) .apply(new RequestOptions() .diskCacheStrategy(DiskCacheStrategy.ALL) .dontAnimate() .centerCrop() .dontTransform()) .into(holder.imageView);
I have doubt in .diskCacheStrategy(DiskCacheStrategy.ALL) Option. There total five type option located with this like below
.diskCacheStrategy(DiskCacheStrategy.ALL) .diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.DATA) .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
I have tried to find its documentation but not able to find difference between this. Let me know if someone have used it and have idea what is difference between this all and when should we use it. Thanks
Disk Cache Strategies The default strategy, AUTOMATIC , tries to use the optimal strategy for local and remote images. AUTOMATIC will store only the unmodified data backing your load when you're loading remote data (like from URLs) because downloading remote data is expensive compared to resizing data already on disk.
@Yeung Glide automatically does caching and it should work as long as the URL is same or image data is not removed due to space limit. Using a signature key is a specific case where you want to have more control over caching.
Further Read this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With