---
title: "storeCachedResponse(_:for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlcache/storecachedresponse(_:for:)-7p7bl"
---

# storeCachedResponse(_:for:)

Stores a cached URL response for a specified request.

## Declaration

```swift
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.

## Mentioned in

Accessing cached data

## Discussion

Discussion If you override this method, you should also override storeCachedResponse(_:for:).

## See Also

### Getting and storing cached objects

- [cachedResponse(for:)](foundation/urlcache/cachedresponse(for:).md)
- [getCachedResponse(for:completionHandler:)](foundation/urlcache/getcachedresponse(for:completionhandler:).md)
- [storeCachedResponse(_:for:)](foundation/urlcache/storecachedresponse(_:for:)-8uq91.md)
