---
title: countLimit
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nscache/countlimit
---

# countLimit

The maximum number of objects the cache should hold.

## Declaration

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

## Discussion

Discussion If 0, there is no count limit. The default value is 0. This is not a strict limit—if the cache goes over the limit, an object in the cache could be evicted instantly, later, or possibly never, depending on the implementation details of the cache.

## See Also

### Managing Cache Size

- [totalCostLimit](foundation/nscache/totalcostlimit.md)
