ronag
ronag

Reputation: 51283

Flush File Read Cache

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

Upvotes: 1

Views: 1189

Answers (2)

Hans Passant
Hans Passant

Reputation: 942257

Try DeviceIoControl with IOCTL_DISK_SET_CACHE_INFORMATION.

Upvotes: 0

Zach Saw
Zach Saw

Reputation: 4378

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