Contents

upgrade(_:cacheMode:context:replyHandler:)

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

Declaration

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.

Discussion

::::: Swift ::::::::::

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

::::::::::::::::::::

::::: ObjC ::::::::::

  • result: A block or closure to indicate success or failure. If successful, pass an instance of FSUpgradeItemResult containing the granted FSVolume.KernelCacheCoherencyType, along with a nil error. If upgrading fails, pass the relevant error as the second parameter; FSKit ignores the 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.

See Also

Changing cache behavior