Sign in Join
FPDoc Onlineexperiment

TFileStateCache.FindFile function

Member of TFileStateCachepublicIn unit LazFileCache

Gets (or creates) the cached item with the specified name.

Declaration

pascal
function FindFile(const Filename: string; CreateIfNotExists: Boolean)
: TFileStateCacheItem

Description

FindFile is a TFileStateCacheItem function used to get, or optionally create, a cache entry for the file or directory in Filename.

FindFile resolves a relative path used in Filename by calling the ResolveDots routine. The normalized name is used to get the TFileStateCacheItem instance in the cache used as the return value for the method.

If Filename was not found in the cache, and CreateIfNotExists is set to True, a TFileStateCacheItem instance is created with the Timestamp for the cache and added to the internal storage. An Exception is raised if the cache item could not be added (and retrieved) using the internal AVL tree storage.

If Filename was not found in the cache, and CreateIfNotExists is set to False, the return value is Nil.

FindFile is used to implement the Check and IncreaseTimeStamp methods.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.