<!--
{
  "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/URLCache/storeCachedResponse(_:for:)-7p7bl",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLCache(im)storeCachedResponse:forRequest:"
  },
  "title" : "storeCachedResponse(_:for:)"
}
-->

# storeCachedResponse(_:for:)

Stores a cached URL response for a specified request.

```
func storeCachedResponse(_ cachedResponse: CachedURLResponse, for request: URLRequest)
```

## Parameters

`cachedResponse`

The cached URL response to store.

`request`

The request for which the cached URL response is being stored.

## Discussion

If you override this method, you should also override [`storeCachedResponse(_:for:)`](/documentation/Foundation/URLCache/storeCachedResponse(_:for:)-8uq91).

---

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)