Re: Clearing file cache to read what's really on disk
- Posted by AndyDrummond Feb 06, 2012
- 1539 views
Sorry, did I say it only happened with NetDrive? It also happens when I am at my desk looking at the file on the internal network.
Right, because your program has written it via NetDrive, but NetDrive hasn't flushed it out from cache to FTP yet, so when you look at it directly you see the older version of the file.
No, I'm writing directly to file via the internal network; the data is being written perfectly. I'm reading via NetDrive so I can do it from home. I can read it fine if I turn off my laptop and power it up again - the first read reads all the data written, and that never changes till I power off & on again.
I can read it through the internal network with notepad - and same thing. The version I read the first time is the only one I read until I power off & on again. [quotejcb]
I can't make the logger write directly to a file actually located on my computer - it's not at a constant IP address.
Well, for test purposes it would be nice to try to have the logger write to a normal file on C: drive, and see if you can see the updates right away.
If that doesn't work, you probably need to call flush() more often.
Beyond that, you could test the logger with a regular mapped drive.
If that doesn't work, you probably need to call flush() more often.
Beyond that, you could test the logger with a regular mapped drive.
A test that completely removes NetDrive from the equation is necessary to demonstrate that this is in fact not a NetDrive problem at all.
I'll scan the two links above but I am pretty sure it's a Windows feature; they cache the file data when it has been read, and just give it back next time you ask for it. Same stuff as before. I should be able to flush the read cache, IMHO.
A
Well, do you have any links documenting this Windoze read cache feature?
No. I will do some more tests since it is clear that there is no simple answer to my initial query. I will write a program to just save ever-increasing text to a file like the logger does, and try the same test on the same machine. And so on. And I will let you know what the result is.
flush() flushes out a write cache; there is no equivalent to clear a read cache, I guess?
A