FlushFile Method

Flushes the specified file's modified blocks out to external storage.

Syntax

public int FlushFile(string fileId, int flushMode, int delay, long fileContext);
Public Function FlushFile(ByVal FileId As String, ByVal FlushMode As Integer, ByVal Delay As Integer, ByVal FileContext As Long) As Integer

Remarks

This method flushes any modified data blocks for the file specified by FileId out to external storage via the WriteData event (and possibly, the ReadFile event, if the cache is forced to retrieve data from external storage before writing it back). The FlushMode parameter specifies what kind of flushing should be performed; it must be one of the following values:

FLUSH_MODE_SYNC0Flush file data synchronously, blocking until finished.

FLUSH_MODE_ASYNC1Flush file data in the background; do not wait until the flush operation completes.

FLUSH_MODE_TEST2Check to see if there's file data that needs to be flushed, but don't actually flush anything.

The Delay parameter may be passed a non-zero number of seconds to delay the flushing operation.

The FileContext parameter may be passed any application-defined value. If the flushing operation causes the file to be opened, the specified value will be passed through to the WriteData and ReadFile events' corresponding parameter. (If the file is already open, the value passed to OpenFile takes precedence).

This method will return one of the following values:

FLUSH_RESULT_NOTHING0The file has no data that needs flushing.

FLUSH_RESULT_DIRTY1The file has data that needs flushing, but no flush operation is running yet.

FLUSH_RESULT_RUNNING2The file's data is in the process of being flushed.

FLUSH_RESULT_SUCCESS3The file's data has been flushed successfully.

.NET Standard Notes

To call this method in an asynchronous manner call FlushFileAsync instead. When the method completes (or an error is encountered) the FlushFileCompleted event will fire.

 
 
Copyright (c) 2020 Callback Technologies, Inc. - All rights reserved.
CBFS Cache 2020 .NET Edition - Version 20.0 [Build 7647]