---
title: memoryCapacity
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlcache/memorycapacity
---

# memoryCapacity

The capacity of the in-memory cache, in bytes.

## Declaration

```swift
var memoryCapacity: Int { get set }
```

## Mentioned in

Accessing cached data

## Discussion

Discussion At the time this property is set, the in-memory cache will truncate its contents to the size given, if necessary.

## See Also

### Getting and setting in-memory cache properties

- [currentMemoryUsage](foundation/urlcache/currentmemoryusage.md)
