Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does iOS clean cache directory automatically?

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.

like image 930
TomSawyer Avatar asked Feb 18 '19 11:02

TomSawyer


People also ask

Does iOS automatically clear cache?

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.

Should I clear the cache on my iPhone?

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.

Where is iOS cache stored?

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.


1 Answers

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)

like image 106
Scriptable Avatar answered Oct 10 '22 15:10

Scriptable