<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSBlockDeviceResource/metadataClear(_:withDelayedWrites:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(cs)FSBlockDeviceResource(im)metadataClear:withDelayedWrites:error:"
  },
  "title" : "metadataClear(_:withDelayedWrites:)"
}
-->

# metadataClear(_:withDelayedWrites:)

Clears the given ranges within the buffer cache.

```
func metadataClear(_ rangesToClear: [FSMetadataRange], withDelayedWrites: Bool) throws
```

## Parameters

`rangesToClear`

The metadata ranges to clear.

`withDelayedWrites`

A Boolean value that determines whether to perform the clear operation with delayed writes. The delay works in the same manner as [`delayedMetadataWriteFrom:startingAt:length:error:`](/documentation/FSKit/FSBlockDeviceResource/delayedMetadataWriteFrom:startingAt:length:error:). When using delayed writes, the client can flush the metadata with [`metadataFlush()`](/documentation/FSKit/FSBlockDeviceResource/metadataFlush()) or [`asynchronousMetadataFlush()`](/documentation/FSKit/FSBlockDeviceResource/asynchronousMetadataFlush()). The system also flushes stale data in the buffer cache periodically.

## Discussion

This method clears the specified ranges in the resource’s buffer cache by writing zeroes into them.

---

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)