I have been trying out Nuke framework for Image caching, from https://github.com/kean/Nuke, across the document I couldn't figure out how to remove an image from cache (both disk and memory), I could find a method from Cache class "removeAll" to remove images from cache , but I have two questions:
I haven't tried anything I am trying to check the documents before trying , so down voting because I don't have attached code isn't fare.
To store unprocessed image data, Nuke uses a URLCache
instance. So you have to call removeAllCachedResponses()
of an appropriate URLCache
instance.
As a result, you can clear image stored in disk as below codes if you use the shared instance of Nuke as mentioned by Sergey Di on the comment
Nuke.Cache.shared.removeAll()
Nuke.DataLoader.sharedUrlCache.removeAllCachedResponses()
If you use a custom shared ImagePipeline, it's a bit complicated but you can do like this code
(ImagePipeline.shared.configuration.dataLoader as? DataLoader)?.session.configuration.urlCache?.removeAllCachedResponses()
I hope my answer would help you.
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