Sign in Join
FPDoc Onlineexperiment

TFileStateCache.Check function

Member of TFileStateCachepublicIn unit LazFileCache

Checks the specified cache item to get a specific flag value.

Declaration

pascal
function Check(const Filename: string; AFlag: TFileStateCacheItemFlag; 
 out AFile: TFileStateCacheItem; var FlagIsSet: Boolean)
: Boolean

Arguments

Filename

File or directory to locate in the cache.

AFlag

Flag to examine for the cache item.

AFile

The cache item examined in the method.

FlagIsSetTrue if the flag was tested and set for the cache item.

Function result

True if the flag is has been tested and set for the cache item.

Description

Check is a Boolean function used to check a flag value in a cache item with the name in Filename.

AFlag identifies the flag value checked for the cache item.

AFile contains the cache item used to get the value for the specified flag. The FindFile method is called to get (or create) a cache item for the specified file or directory name. AFile is an output parameter, and is used to return the TFileStateCacheItem instance to the caller.

Check ensures that the cache item is valid (recent) using the Timestamp for the class instance. When TimeStamp is more recent than the value in the cache item, the cache item is updated with the current Timestamp and its tested flags are cleared.

FlagIsSet is a variable parameter which contains the state for the specific flag. True indicates the flag is set for the cache item. False indicates that the flag was not already set in the cache item, or has not been tested after resetting the Timestamp for an invalid cache item.

The return value is True when the flag in AFlag is one of the tested flags in an existing cache item. It is False if the flag value has not been accessed in the cache item, or when the Timestamp for an invalid cache item was reset.

Check is used to implement methods which get or set specific flag values, including:

  • FileExistsCached
  • DirPathExistsCached
  • DirectoryIsWritableCached
  • FileIsExecutableCached
  • FileIsReadableCached
  • FileIsWritableCached
  • FileIsTextCached
  • FileAgeCached
  • GetPhysicalFilenameCached

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.