---
title: setWriteCacheState
framework: kernel
role: pseudoSymbol
path: kernel/ioblockstoragedevice/1811812-setwritecachestate
---

# setWriteCacheState

Sets the write cache state of the device.

## Declaration

```occ
#ifdef __LP64__
 virtual IOReturn setWriteCacheState(
 bool enabled) = 0; 
#else /* !__LP64__ */
virtual IOReturn setWriteCacheState(
 bool enabled); 
#endif 
/* !__LP64__ */
```

## Parameters

- `enabled`: True to enable the write cache; False to disable the write cache.

## Overview

Overview Sets the write cache state of the device. The write cache state is not guaranteed to persist across reboots and detaches.

## See Also

### Miscellaneous

- [doAsyncReadWrite](kernel/ioblockstoragedevice/1811665-doasyncreadwrite.md)
- [doEjectMedia](kernel/ioblockstoragedevice/1811672-doejectmedia.md)
- [doFormatMedia](kernel/ioblockstoragedevice/1811680-doformatmedia.md)
- [doGetFormatCapacities](kernel/ioblockstoragedevice/1811684-dogetformatcapacities.md)
- [doSynchronizeCache](kernel/ioblockstoragedevice/1811691-dosynchronizecache.md)
- [doUnmap](kernel/ioblockstoragedevice/1811698-dounmap.md)
- [getAdditionalDeviceInfoString](kernel/ioblockstoragedevice/1811705-getadditionaldeviceinfostring.md)
- [getProductString](kernel/ioblockstoragedevice/1811712-getproductstring.md)
- [getRevisionString](kernel/ioblockstoragedevice/1811717-getrevisionstring.md)
- [getVendorString](kernel/ioblockstoragedevice/1811724-getvendorstring.md)
- [getWriteCacheState](kernel/ioblockstoragedevice/1811731-getwritecachestate.md)
- [init](kernel/ioblockstoragedevice/1811746-init.md)
- [reportBlockSize](kernel/ioblockstoragedevice/1811753-reportblocksize.md)
- [reportEjectability](kernel/ioblockstoragedevice/1811761-reportejectability.md)
- [reportMaxValidBlock](kernel/ioblockstoragedevice/1811771-reportmaxvalidblock.md)
- [reportMediaState](kernel/ioblockstoragedevice/1811780-reportmediastate.md)
- [reportRemovability](kernel/ioblockstoragedevice/1811787-reportremovability.md)
- [reportWriteProtection](kernel/ioblockstoragedevice/1811796-reportwriteprotection.md)
- [requestIdle](kernel/ioblockstoragedevice/1811804-requestidle.md)
