---
title: NSURLRequest.CachePolicy.useProtocolCachePolicy
framework: foundation
role: symbol
role_heading: Case
path: foundation/nsurlrequest/cachepolicy-swift.enum/useprotocolcachepolicy
---

# NSURLRequest.CachePolicy.useProtocolCachePolicy

Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.

## Declaration

```swift
case useProtocolCachePolicy
```

## Mentioned in

Accessing cached data

## Discussion

Discussion This is the default policy for URL load requests. HTTP caching behavior For the HTTP and HTTPS protocols, NSURLRequest.CachePolicy.useProtocolCachePolicy 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 the figure below.

note: For the formal definition of these semantics, see RFC 2616. important: If you are making HTTP or HTTPS byte-range requests, always use the NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData policy instead.

## See Also

### Policies

- [NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData](foundation/nsurlrequest/cachepolicy-swift.enum/reloadignoringlocalcachedata.md)
- [NSURLRequest.CachePolicy.reloadIgnoringLocalAndRemoteCacheData](foundation/nsurlrequest/cachepolicy-swift.enum/reloadignoringlocalandremotecachedata.md)
- [reloadIgnoringCacheData](foundation/nsurlrequest/cachepolicy-swift.enum/reloadignoringcachedata.md)
- [NSURLRequest.CachePolicy.returnCacheDataElseLoad](foundation/nsurlrequest/cachepolicy-swift.enum/returncachedataelseload.md)
- [NSURLRequest.CachePolicy.returnCacheDataDontLoad](foundation/nsurlrequest/cachepolicy-swift.enum/returncachedatadontload.md)
- [NSURLRequest.CachePolicy.reloadRevalidatingCacheData](foundation/nsurlrequest/cachepolicy-swift.enum/reloadrevalidatingcachedata.md)
