<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/CachedURLResponse",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCachedURLResponse"
  },
  "title" : "CachedURLResponse"
}
-->

# CachedURLResponse

A cached response to a URL request.

```
class CachedURLResponse
```

## Overview

A [`CachedURLResponse`](/documentation/Foundation/CachedURLResponse) object provides the server’s response metadata in the form of a [`URLResponse`](/documentation/Foundation/URLResponse) object, along with an [NSData](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/OldStylePlists/OldStylePLists.html#//apple_ref/doc/uid/20001012-47169) 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`](/documentation/Foundation/URLCache) class stores and retrieves instances of [`CachedURLResponse`](/documentation/Foundation/CachedURLResponse).

## Topics

### Creating a cached URL response

[`init(response:data:)`](/documentation/Foundation/CachedURLResponse/init(response:data:))

Creates a cached URL response instance.

[`init(response:data:userInfo:storagePolicy:)`](/documentation/Foundation/CachedURLResponse/init(response:data:userInfo:storagePolicy:))

Creates a cached URL response with a given server response, data, user-info dictionary, and storage policy.

### Getting cached URL response properties

[`data`](/documentation/Foundation/CachedURLResponse/data)

The cached response’s data.

[`response`](/documentation/Foundation/CachedURLResponse/response)

The URL response object associated with the instance.

[`storagePolicy`](/documentation/Foundation/CachedURLResponse/storagePolicy)

The cached response’s storage policy.

[`userInfo`](/documentation/Foundation/CachedURLResponse/userInfo)

The cached response’s user info dictionary.

### Setting cache storage policies

[`URLCache.StoragePolicy`](/documentation/Foundation/URLCache/StoragePolicy)

These constants specify the caching strategy used by an [`CachedURLResponse`](/documentation/Foundation/CachedURLResponse) object.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)