Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.
- iOS 2.0+
- macOS 10.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
This is the default policy for URL load requests.
HTTP Cacheing Behavior
For the HTTP and HTTPS protocols,
NSURLRequest performs the following behavior:
If a cached response does not exist for the request, the URL loading system fetches the data from the originating source.
Otherwise, if the cached response does not indicate that it must be revalidated every time, and if the cached response is not stale (past its expiration date), the URL loading system returns the cached response.
If the cached response is stale or requires revalidation, the URL loading system makes a HEAD request to the originating source to see if the resource has changed. If so, the URL loading system fetches the data from the originating source. Otherwise, it returns the cached response.
This behavior is illustrated in Figure 1.