Universal image loader recache from Internet - android

I use the Android Universal image loader,
and I set cacheInMemory and cacheOnDisc values to true.
Therefore, the imageloader downloads the images from the Internet,
and there images will be cached in order to load much more fast at the next time.
My question is that if these URLs of images are same but its contents are changed,
how the imageloader determine and resolve that situation and refresh these images of caches?

By default UIL doesn't check if image was changed on server. If image was cached on disk it will be used until it's deleted. So there are LimitedAgeMemoryCache and LimitedAgeDiscCache are exists for this case. They delete cached images after some time amount so updated images are loaded from server.

Related

Caching with Glide

I'm using Glide and want to cache loaded images to local memory.
I searched for the same, and found out that images are cached automatically. You just need to provide the same loadURL , and Glide will search for image (along with other provided attrs : Resolution, Key, etc). The problem that I'm facing is that, I know what the loadURL will be at the time of initial resource load. But when the app wants to load the cached copy of, it doesn't have any loadURL info. How can I load cached images without providing loadURL (which was same at the time of initial load). Can I use any key (say StringKey), which can be associated with the image at initial load, and use the same key (without loadURL) at the time of loading cached copy? Thank you.
Glide doesn't support directly accessing the cache.
So, just persist the url the first time and use it later to load the cached image.
First time:
Glide.with(this).load(url).into(image);
save(url);
Later:
String url = getUrl();
Glide.with(this).load(url).into(image);

Android Picasso store files or use cache

I'm using Picasso to initially download images of products to my app from a server. Since the images aren't changing nearly at all for a certain product, I save the images to the disk from the ImageView. In the app I have to display these images all over again in different sizes. To do so I'm using Picasso again, loading the saved file into an ImageView and do fit().centercrop() so I don't get any OutofMemory issues.
Since Picasso is also capable of using OkHttp's cache and doing the caching by its own, I want to know:
Are there any advantages about letting Picasso do the caching, over saving it to storage manually and handing it over again to Picasso later?
And would it be a good way to store the shrinked image (after using .fit()) as a new file so the calculation hasn't to be done all the time.

Can Universal Image Loader use different DiskCache for images?

I'm using Universal Image Loader for image loading, In the document I can't find a way to set different DiskCache for image display, the DiskCache directory is set by ImageLoader.getInstance().init(), which is global.
But I want to store some images in a separate DiskCache because I don't want it to be removed when LruDiskCache is full or cleared manually, I there anyway to do this?
I am afraid UIL can't store specific image files intently. If I guess right, these images that you want to store in separate directory are used frequently. But, maybe you don't understand the mechanism of LruDiskCache which means "least recently used disk cache". Which means files used frequently would at the header of the queue all the time. So, if you use LruDiskCache, these images used frequently will be always stored in the disk and not be deleted or cleared. So, your requirement has been fulfilled when you use LruDiskCache.

Android Image fetching library

Hi i wanted to know is their any library in which we pass the URL and the image-view and it checks whether the images is present on device if not, then fetch image from URL and store to device and bind with the view passed. I tried writing the code but once the view is loaded and image is not fetched the images is never fetched in future unless i uninstall the app , i also tried universal image loader library and asynchronous image loader
Picasso is doing all things what you want.
It loads from internet and cache
It loads from cache
It loads from Local File
Read More Here And Here
Try volley library. you have a NetworkImageView I guess. Which fits your need.

Universal Image Loader enable/disable disc cache for each image

In my android app, I am using Universal Image Loader to display images.
I specified in the option to caching images on Disc. But sometimes there are images that I do not want to cache on the disc. Is there a way to specify if it should cache on disc or not for each time I download an image and not only in the initialization?
Thanks
I just created 2 options one with caching and one without and used each one accordingly.
Will leave it here in case.

Categories

Resources