News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How does one invalidate the file cache?

Started by jj2007, August 22, 2018, 07:51:26 PM

Previous topic - Next topic

jj2007

See ClearFileCache.

FindFirstFile is the only viable way. It's not that slow, actually, provided the info is already in the cache.

aw27


jj2007


aw27

I have used it only with pipes. I have no clear scenario to use it with files or folders - usually the cache is pretty intelligent. However, in a particularly busy system, we may need to force it to flush right away.

jj2007

Quote from: AW on August 23, 2018, 05:33:05 AMI have no clear scenario

I have a testbed (loops=1000):

  NanoTimer()
  For_ ct=0 To loops-1
        Open "U", #1, edi
        invoke FlushFileBuffers, MbFH[4]
        Let esi=Input$(#1, Min(MbBufSize/4, Lof(#1)))
        Close #1
  Next
  Inkey NanoTimer$(), " for FlushFileBuffers & file read"


67 ms for cached file read
3565 ms for ClearFileCache + file read
417 ms for FlushFileBuffers & file read