ronag
ronag

Reputation: 51255

Flush File Read Cache

How do I flush (empty) the windows file read cache using C++ win32api?

Upvotes: 1

Views: 1184

Answers (2)

Hans Passant
Hans Passant

Reputation: 941257

Try DeviceIoControl with IOCTL_DISK_SET_CACHE_INFORMATION.

Upvotes: 0

Zach Saw
Zach Saw

Reputation: 4368

I don't think you can (you could flush write cache), but you could always open your file via CreateFile with FILE_FLAG_NO_BUFFERING. This way, your reads would not be from the system cache, but straight from your device (which may cache data).

Upvotes: 2

Related Questions