---
title: CachedURLResponse
framework: foundation
role: symbol
role_heading: Class
path: foundation/cachedurlresponse
---

# CachedURLResponse

A cached response to a URL request.

## Declaration

```swift
class CachedURLResponse
```

## Mentioned in

Accessing cached data

## Overview

Overview A CachedURLResponse object provides the server’s response metadata in the form of a URLResponse object, along with an NSData object containing the actual cached content data. Its storage policy determines whether the response should be cached on disk, in memory, or not at all. Cached responses also contain a user info dictionary where you can store app-specific information about the cached item. The URLCache class stores and retrieves instances of CachedURLResponse.

## Topics

### Creating a cached URL response

- [init(response:data:)](foundation/cachedurlresponse/init(response:data:).md)
- [init(response:data:userInfo:storagePolicy:)](foundation/cachedurlresponse/init(response:data:userinfo:storagepolicy:).md)

### Getting cached URL response properties

- [data](foundation/cachedurlresponse/data.md)
- [response](foundation/cachedurlresponse/response.md)
- [storagePolicy](foundation/cachedurlresponse/storagepolicy.md)
- [userInfo](foundation/cachedurlresponse/userinfo.md)

### Setting cache storage policies

- [URLCache.StoragePolicy](foundation/urlcache/storagepolicy.md)

### Initializers

- [init(coder:)](foundation/cachedurlresponse/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Cache behavior

- [Accessing cached data](foundation/accessing-cached-data.md)
- [URLCache](foundation/urlcache.md)
