I'm saving media files at this path and i wonder does iOS auto clean the cache or i have to do it manually?
let documentsUrl = self.fileManager.urls(for: .cachesDirectory, in: .userDomainMask).first!
Searched and there is no particular answer for it.
If you want to free up storage space on your iPhone, clearing the cache is one way to do it. Some of this is done automatically by iOS, but you can also do it manually. The other reason to clear the iPhone cache is that cached files sometimes slow down the phone or cause things to behave in ways you don't want.
Cache data can slow down your phone's browsing performance since it takes up storage space in your device, so it's good to clear it out regularly.
Go to Settings > General > [Device] Storage. You might see a list of recommendations for optimizing your device's storage, followed by a list of installed apps and the amount of storage each one uses. Tap an app's name for more information about its storage. Cached data and temporary data might not be counted as usage.
The operating system can clear this folder if needed.
Documentation
Put data cache files in the Library/Caches/ directory. Cache data can be used for any data that needs to persist longer than temporary data, but not as long as a support file. Generally speaking, the application does not require cache data to operate properly, but it can use cache data to improve performance. Examples of cache data include (but are not limited to) database cache files and transient, downloadable content. Note that the system may delete the Caches/ directory to free up disk space, so your app must be able to re-create or download these files as needed. (emphasis mine)
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