Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Use iOS/OS X NSURLRequest’s NSURLRequestReturnCacheDataElseLoad #1824

Closed
kkaefer opened this issue Jul 2, 2015 · 3 comments
Closed

Use iOS/OS X NSURLRequest’s NSURLRequestReturnCacheDataElseLoad #1824

kkaefer opened this issue Jul 2, 2015 · 3 comments

Comments

@kkaefer
Copy link
Contributor

kkaefer commented Jul 2, 2015

We're currently implementing our own SQLite-based caching so that we can implement custom caching logic. We circumvent NSURL*'s caches by specifying NSURLRequestReloadIgnoringLocalCacheData when loading resources so that we can implement our own interpretation of the HTTP caching spec.

With iOS 9, network caches are shared across all apps, and using it could benefit GL native when the user uses more than one application that has GL maps. NSURLRequest actually supports what we want to do by specifying NSURLRequestReloadIgnoringLocalCacheData, so we could replace our SQLiteCache implementation for Cocoa with a lookup in the global cache (e.g. by specifying NSURLRequestReturnCacheDataDontLoad, which just obtains cached data if it's there and doesn't load otherwise).

@mb12
Copy link

mb12 commented Jul 2, 2015

Tile URLs have a vendor specific mapbox access token. Wouldn't it prevent caching across apps?

@kkaefer
Copy link
Contributor Author

kkaefer commented Jul 2, 2015

Tile URLs have a vendor specific mapbox access token. Wouldn't it prevent caching across apps?

Good point; this probably makes it impossible to cache across apps anyway. Also, @1ec5 informs me that the network cache sharing is just for the Safari in-app browser, and not for the generic networking stack. This probably means it doesn't make sense to pursue this.

FWIW, we are normalizing mapbox.com URLs so they drop the access_token when caching, so requests can be cached (in one app) regardless of the access token.

@jfirebaugh
Copy link
Contributor

Closing since it sounds like this is a dead end.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants