<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAI",
  "identifier" : "/documentation/CoreAI/AIModelCache/Policy",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core AI",
      "CoreAI"
    ],
    "preciseIdentifier" : "s:15CoreAIDelegates12AIModelCacheC6PolicyV"
  },
  "title" : "AIModelCache.Policy"
}
-->

# AIModelCache.Policy

A policy that controls when the system purges specialized assets from a cache.

```
struct Policy
```

## Overview

Defines the conditions under which the system may purge specialized
assets in an [`AIModelCache`](/documentation/CoreAI/AIModelCache).

> Note: Regardless of policy, the system always purges assets when the OS
> updates, as specialized assets are OS-version specific.

## Topics

### Using preset policies

[`static let `default`: AIModelCache.Policy`](/documentation/CoreAI/AIModelCache/Policy/default)

A policy that marks specialized assets as purgeable.

[`static let persistent: AIModelCache.Policy`](/documentation/CoreAI/AIModelCache/Policy/persistent)

A policy that prevents automatic purging of specialized assets.

### Creating a custom policy

[`init(purgeConditions: AIModelCache.Policy.PurgeConditions)`](/documentation/CoreAI/AIModelCache/Policy/init(purgeConditions:))

Creates a policy with the specified purge conditions.

### Inspecting a policy

[`var purgeConditions: AIModelCache.Policy.PurgeConditions`](/documentation/CoreAI/AIModelCache/Policy/purgeConditions-swift.property)

The conditions under which the system may purge specialized assets.

### Describing purge conditions

[`struct PurgeConditions`](/documentation/CoreAI/AIModelCache/Policy/PurgeConditions-swift.struct)

A set of conditions that determine when the system purges specialized assets.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`Encodable`](/documentation/Swift/Encodable)

[`Decodable`](/documentation/Swift/Decodable)

[`Sendable`](/documentation/Swift/Sendable)

---

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)