I am using HanekeSwift to download an image from URL and set it in the UIImage.
I am doing it like .hnk_setImageFromURL()
The image URL gets updated with new image frequently and I need to download the new image. But as the image is already available in cache, the image is taken from the cache and not from the url fetch. In order to solve this I tried to remove cache entry for this key(i.e URL) using Shared.imageCache.remove(key: ).
Even after doing this the image is fetched from the cache and I do not see any network calls. Looks like the remove(key:) function is not working as expected.
Help me to find a solution for this issue.
If you are cacheing image using
image.hnk_setImageFromURL(URL)
in that case you have to remove all cache for image instance ,but if you are cache image using with key value pair you can remove cache using it key.example
If i cache image like
in above case you can remove cache using
imageCache.removeAll()
but if you are cache image likeimageview.hnk_setImage(UIImage(), key:"image")
in that case you can remove usingimageCache.remove(key: "image")
you can also cache image using
imageCache.set(value: UIImage(named:""), key: "image")
and remove cache usingimageCache.remove(key: "image")