You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Storing offline.db in user caches directory bad idea on OS X #4371
The caches directory may get purged by the system at any time. It is not hard to imagine a case where a user is offline, depending on their offline map regions, and fills up their device in some other way (e.g., taking a lot of photos). In such a case the system could and would purge the user cache directory and remove the Mapbox SDK's offline db.
The code linked above places the offline.db file inside the Documents directory, not the Caches directory. MGLMapView does place the cache.db file inside the Caches directory, but that file is used for ambient caching and can be regenerated cheaply.
In #4362, @jfirebaugh pointed out that both files should be unified, which probably means the unified cache would go in the Documents directory. Unfortunately this means that an application that doesn’t use offline packs will nonetheless have a cache.db file hanging around in its documents list in iTunes. But we are currently avoiding using the Caches directory for offline downloads and will continue to avoid it for the reason you point out.
However, this code does store the offline cache in the Caches directory on OS X. Although OS X isn’t nearly as aggressive as iOS in purging the Caches directory, we should be putting the OS X offline cache in Application Support, not Caches.
changed the title [-]Storing offline.db in user caches directory bad idea on iOS[/-][+]Storing offline.db in user caches directory bad idea on OS X[/+]on Mar 17, 2016
Activity
1ec5 commentedon Mar 17, 2016
The code linked above places the offline.db file inside the Documents directory, not the Caches directory. MGLMapView does place the cache.db file inside the Caches directory, but that file is used for ambient caching and can be regenerated cheaply.
In #4362, @jfirebaugh pointed out that both files should be unified, which probably means the unified cache would go in the Documents directory. Unfortunately this means that an application that doesn’t use offline packs will nonetheless have a cache.db file hanging around in its documents list in iTunes. But we are currently avoiding using the Caches directory for offline downloads and will continue to avoid it for the reason you point out.
1ec5 commentedon Mar 17, 2016
However, this code does store the offline cache in the Caches directory on OS X. Although OS X isn’t nearly as aggressive as iOS in purging the Caches directory, we should be putting the OS X offline cache in Application Support, not Caches.
[-]Storing offline.db in user caches directory bad idea on iOS[/-][+]Storing offline.db in user caches directory bad idea on OS X[/+][osx] Place offline cache in Application Support
1ec5 commentedon Mar 18, 2016
Closing in favor of #4362.
postmechanical commentedon Mar 18, 2016
@1ec5 Thanks! Sorry for misreading the linked lines of code. I saw the OS X lines and 💥.