<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSVolume/DataCacheHandler/upgrade(_:cacheMode:context:replyHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(pl)FSVolumeDataCacheHandler(im)upgradeItem:cacheMode:context:replyHandler:"
  },
  "title" : "upgrade(_:cacheMode:context:replyHandler:)"
}
-->

# upgrade(_:cacheMode:context:replyHandler:)

Upgrades the item cache mode to a less restrictive level, allowing more caching.

```
func upgrade(_ item: FSItem, cacheMode: FSVolume.DataCacheMode, context: FSContext, replyHandler reply: @escaping @Sendable (FSUpgradeItemResult?, (any Error)?) -> Void)
```

```
func upgrade(_ item: FSItem, cacheMode: FSVolume.DataCacheMode, context: FSContext) async throws -> FSUpgradeItemResult
```

## Parameters

`item`

The item for which to upgrade the cache mode.

`cacheMode`

The new (more permissive) cache mode being requested.

`context`

An object that enables context-aware file system decisions throughout the operation.

`reply`

A block or closure to indicate success or failure. If successful, pass an instance of [`FSUpgradeItemResult`](/documentation/FSKit/FSUpgradeItemResult) containing the granted [`FSVolume.KernelCacheCoherencyType`](/documentation/FSKit/FSVolume/KernelCacheCoherencyType), along with a `nil` error. If upgrading fails, pass the relevant error as the second parameter; FSKit ignores the [`FSUpgradeItemResult`](/documentation/FSKit/FSUpgradeItemResult) instance in this case. For an `async` Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

## Discussion

FSKit calls this method when transitioning to a cache mode that allows more aggressive caching.

---

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)