Interface: missingPathCache

3ds Max scenes can contain references to assets in many locations, including local drives and network shares. When a scene is loaded or saved, 3ds Max checks whether asset paths exist, and maintains a cache of missing file paths. This optimizes file load and save times, since once a missing file path is added to the cache, subsequent asset paths that match this path do not need to be queried in the filesystem, an expensive operation.

For example, in tests involving 150 scene assets split among local and network shares, with some missing assets and file operation times exceeding 30 seconds (the OS file caching time), file load time is reduced by about 70% and file save by almost 80%.

Available in 3ds Max 2018.4 and higher.

NOTE:Only missing paths are cached. If an asset is missing, but its parent directory is present, the path is not added to the cache.
NOTE:By default, the case sensitivity setting (missingPathCache.cacheCaseSensitive) is true for robustness. However, we recommend you set this to false for performance reasons, if your file servers are not case sensitive.

The Missing Path Cache is exposed in MAXScript in the missingPathCache interface.

Properties:

missingPathCache.cacheEntryValidityTime : integer : Read|Write|Validated by Range: 0 to 2147483647

When sweeping the cache for entries that need to be tested to see if the entry now exists and should be removed from the cache, an entry is not tested if its previous test time plus cacheEntryValidityTime is less than the current time. The default is 5000 (5 seconds).

missingPathCache.cacheEntryPurgeTime : integer : Read|Write|Validated by Range: 0 to 2147483647

When sweeping the cache, any entries that haven't been used to specify a filepath as not present within the last cacheEntryPurgeTime milliseconds will be removed from the cache. The default is 3600000 (1 hour).

missingPathCache.cacheSweepInterval : integer : Read|Write|Validated by Range: 0 to 2147483647

The time interval between cache sweeps. The default is 1000 (1 second).

missingPathCache.cacheEnabled : bool : Read|Write

Whether the cache is used to during filepath existence testing. Turning this off does not clear the cache. Default is true.

missingPathCache.includeFileWatchInSweep : bool : Read|Write

Whether a cache entry that has a FileWatch associated with it should also be tested for existence during a cache sweep. This is present to handle any potential cases where it is found that a FileWatch does not properly fire when directory-related changes occur to the folder the FileWatch is applied to. This would most likely occur with obscure file servers. No such cases are known. The default is false.

missingPathCache.existsTimeBackgroundThreshold : float : Read|Write

When a filepath is being tested for existence and it is not in the cache, the time it took to perform that test is measured. If this time is less than the existsTimeBackgroundThreshold, the filepath is processed for adding to the cache in the main thread. If it takes more than this time, the filepath is processed for adding to the cache in a worker thread. Setting this value to 0 forces all such processing to a worker thread. This value is in tenths of a millisecond, with a default value of 2.

missingPathCache.cacheCaseSensitive : bool : Read|Write

Whether the testing of a filepath against the cache should be case sensitive. Normally this can be set to false, but for some file servers it may need to be true. For robustness, the default is true. It is recommended to set this to false if your file servers are not case sensitive.

missingPathCache.cacheLocalDrives : bool : Read|Write

Whether to cache missing folders on local drives. Since file existence testing on local drives is fast, normally this setting should be false. The default is false.

Note that changing this setting does not affect existing cache entries.

missingPathCache.clearCacheOnFileReset : bool : Read|Write

Whether to clear the missing path cache when 3ds Max is reset. The default is false.

missingPathCache.clearCacheOnSceneLoad : bool : Read|Write

Whether to clear the missing path cache before a scene is loaded. The default is false.

missingPathCache.persistSettingsOnExit : bool : Read|Write

Whether to persist cache settings to 3dsmax.ini on 3ds Max exit. The default is true.

missingPathCache.useFileWatch : bool : Read|Write

Whether to use FileWatch handles when possible. The default is true.

missingPathCache.numCacheEntries : INT64 : Read

Performance statistic: the number of cache entries.

missingPathCache.numCacheHits : INT64 : Read

Performance statistic: the number of filepath existence tests satisfied by cache hit.

missingPathCache.numCacheTests : INT64 : Read

Performance statistic: the number of filepath existence tests while the cache was enabled.

missingPathCache.numCacheSweeps : INT64 : Read

Performance statistic: the number of cache sweeps that have occurred.

missingPathCache.numThreadsSpawned : INT64 : Read

Performance statistic: the number of cache entry existence test threads that have been created during cache sweeps.

missingPathCache.numDoesExistTests : INT64 : Read

Performance statistic: the number of DoesFileExist() and DoesDirectoryExist() calls that have occurred.

missingPathCache.cacheSweepCumTime : INT64 : Read

Performance statistic - the amount of time spent sweeping the cache. Note that this is occurring in its own thread.

missingPathCache.cacheSweepMaxTime : INT64 : Read

Performance statistic: the maximum amount of time it took to sweep the cache. Note that this is occurring in its own thread.

missingPathCache.numFileWatchedEntries : INT64 : Read

Performance statistic: the max number of cache entries using FileWatch handles.

missingPathCache.numFileWatchedEntriesCum : INT64 : Read

Performance statistic: the commutative number of cache entries using FileWatch handles.

missingPathCache.numFileWatchedEntriesMax : INT64 : Read

Performance statistic: the max number of cache entries using FileWatch handles.

missingPathCache.isFilePathInCacheCumTime : double : Read

Performance statistic: the commutative amount of time spent testing to see if a filepath is in the cache

missingPathCache.isFilePathInCacheMaxTime : double : Read

Performance statistic: the maximum amount of time spent testing to see if a filepath is in the cache

missingPathCache.doesExistCumTime : double : Read

P erformance statistic: the cumulative amount of time spent testing to see if a filepath exists

missingPathCache.doesExistMaxTime : double : Read

Performance statistic: the maximum amount of time spent testing to see if a filepath exists

Methods:

    <bool>missingPathCache.IsFilePathInCache <filename>filePath

Returns true if any part of the filePath is present in the cache. Primarily used for testing.

    <bool>missingPathCache.DoesFileExist <filename>filePath allowDirectory:<bool>
       allowDirectory default value: true

Returns true if the filePath exists, either as a file or as a directory.

If allowDirectory is true, the method returns true if filePath exists as a directory, if false the method will return false if filePath exists as a directory.

    <bool>missingPathCache.DoesDirectoryExist <filename>dirPath

Returns true if the dirPath exists as a directory.

    <void>missingPathCache.SeedCacheWithFilePath <filename>filePath

Performs a file existence test of filePath in a worker thread. The purpose of this is to seed the cache with filePath if the file doesn't exist when you don't currently need to know whether the file exists, but expect to want to know later. By seeding the cache, that later file existence test will likely run faster if the filePath doesn't exist because its directory doesn't exist.

    <void>missingPathCache.Reset()

Removes all entries from the cache.

    <void>missingPathCache.ResetStatistics()

Resets all the performance statistic variables to 0.

    <TSTR by value array>missingPathCache.GetNotPresentPaths unusedTime:<&INT64 array>
       unusedTime default value: #()
       unusedTime is Out parameter

Returns an array of the cache entry missing folder names. If unusedTime is specified, on return it will return an array of Integer64 values which are the time in milliseconds since the corresponded entry in the cache was used to specify a filepath as not present.

    <bool>missingPathCache.RemoveEntry <filename>filePath

Removes the specified filePath cache entry if present. The specified filePath must match the cache entry exactly. Returns true if an entry was removed, otherwise false.

   <void>LoadINISettings()

Loads cache settings from 3dsmax.ini.

    <void>SaveINISettings()

Saves cache settings to 3dsmax.ini.

Actions:

None