Can I clear metadata cache?
You can clear the cache for a separate file/directory by using NotifyDirectoryChange() method.
The cache for the disk in whole can be cleared by setting the MetaDataCacheEnabled property to false and back to true.
The second method doesn't work for files/directories that are currently opened by programs. I.e. opened files still have the "old" attributes.
In case of NotifyDirectoryChange if you specify flags other than the fanMetaDataModified (i.e. you specify that file contents has been changed outside CallbackFS) and a file is currently opened then CallbackFS makes all handles to the file invalid. This means that any I/O operation with these handles will immediately return error. The only successful operation will be closing such handle using CloseHandle() WinAPI function.
In the case when the fanMetaDataModified flag is used and a file is opened its handles remain valid and only its metadata (file attributes and file size) will be re-requested when it's necessary using OnGetFileInfo or OnEnumerateDirectory callbacks.