swiftui-cached-async-image icon indicating copy to clipboard operation
swiftui-cached-async-image copied to clipboard

Cache clearing

Open ericalas93 opened this issue 1 year ago • 3 comments

Is there a recommended way to clear the cache? I have tried URLCache.shared.removeAllCachedResponses() but noticed that when I go to settings -> storage -> my app, Documents & Data it doesn’t go down.

My apologies if this is a silly question, rather new to iOS development, thanks for a great library!

ericalas93 avatar Aug 27 '23 18:08 ericalas93

+1. Is there a possibility for this? I would like to add a clear cache option in the app, and this would help a lot.

neoighodaro avatar Oct 07 '23 10:10 neoighodaro

If you use the extension

extension URLCache { static let imageCache = URLCache(memoryCapacity: 512*1000*1000, diskCapacity: 10*1000*1000*1000) }

You can do URLCache.imageCache.removeAllCachedResponses() and it seems to be working

LoopingStudio avatar Oct 13 '23 23:10 LoopingStudio

Thank you kind person!

neoighodaro avatar Oct 14 '23 16:10 neoighodaro