One of my concern is this. In URLCache documentation, it says:
I don't want my on-disk cache to get purged on low disk space.Note
In iOS, the on-disk cache may be purged when the system runs low on disk space, but only when your app is not running.
I browse around and see URLCache has a new initializer in iOS 13 that accepts a directory url for on-disk cache.
Code Block convenience init(memoryCapacity: Int, diskCapacity: Int, directory: URL? = nil)
From my understanding, Caches directory gets purged on low disk space.
From File System Programming Guide:
So, my question is, if I pass a URL that is not a Caches directory URL. Will my on-disk cache survive the low memory purge? If not, is there any other way to achieve it?In iOS 5.0 and later, the system may delete the Caches directory on rare occasions when the system is very low on disk space. This will never occur while an app is running. However, be aware that restoring from backup is not necessarily the only condition under which the Caches directory can be erased.