---
title: urlCache
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlsessionconfiguration/urlcache
---

# urlCache

The URL cache for providing cached responses to requests within the session.

## Declaration

```swift
var urlCache: URLCache? { get set }
```

## Mentioned in

Accessing cached data

## Discussion

Discussion This property determines the URL cache object used by tasks within sessions based on this configuration. To disable caching, set this property to nil. For default sessions, the default value is the shared URL cache object. For background sessions, the default value is nil. For ephemeral sessions, the default value is a private cache object that stores data in memory only, and is destroyed when you invalidate the session.

## See Also

### Setting caching policies

- [requestCachePolicy](foundation/urlsessionconfiguration/requestcachepolicy.md)
