Skip to content

DependencyResultCache

ClassAssetInventoryAssetInventory.Editor
public sealed class DependencyResultCache

Cache for dependency calculation results to avoid redundant traversal of the same dependency trees. When File A and File B both depend on Material C, Material C’s dependencies are only calculated once.

GetMaterializedPathKey(int, string, string)

Section titled “GetMaterializedPathKey(int, string, string)”
public static string GetMaterializedPathKey(int assetId, string guid, string path = null)

Generates a consistent cache key for materialized path storage. Format: “{assetId}{guid}” when GUID is available, or “path:{assetId}{path}” as fallback for files without GUIDs.

Parameters

Name Type Description
assetId System.Int32
guid System.String
path System.String

Returns

System.String — No return description is available.

public static string GetMaterializedPathKey(AssetInfo info)

Generates a consistent cache key for materialized path storage from AssetInfo. Uses GUID when available, falls back to Path for files without GUIDs.

Parameters

Name Type Description
info AssetInventory.AssetInfo

Returns

System.String — No return description is available.

public static string GetMaterializedPathKey(int assetId, AssetFile file)

Generates a consistent cache key for materialized path storage from AssetFile. Uses GUID when available, falls back to Path for files without GUIDs.

Parameters

Name Type Description
assetId System.Int32
file AssetInventory.AssetFile

Returns

System.String — No return description is available.

TryGetDependencies(int, string, out CachedDependencyResult)

Section titled “TryGetDependencies(int, string, out CachedDependencyResult)”
public bool TryGetDependencies(int assetId, string guid, out DependencyResultCache.CachedDependencyResult result)

Try to get cached dependency result for a file. Key is scoped by AssetId to prevent cross-package cache contamination when files share the same GUID across different packages.

Parameters

Name Type Description
assetId System.Int32
guid System.String
result AssetInventory.DependencyResultCache.CachedDependencyResult

Returns

System.Boolean — No return description is available.

StoreDependencies(int, string, CachedDependencyResult)

Section titled “StoreDependencies(int, string, CachedDependencyResult)”
public void StoreDependencies(int assetId, string guid, DependencyResultCache.CachedDependencyResult result)

Store dependency calculation result for a file. Key is scoped by AssetId to prevent cross-package cache contamination when files share the same GUID across different packages.

Parameters

Name Type Description
assetId System.Int32
guid System.String
result AssetInventory.DependencyResultCache.CachedDependencyResult
public void PreloadPackageFiles(int assetId, List<AssetFile> files)

Pre-load all AssetFile records for a package to eliminate repeated DB queries

Parameters

Name Type Description
assetId System.Int32
files System.Collections.Generic.List{AssetInventory.AssetFile}
public AssetFile TryGetAssetFile(int assetId, string guid)

Try to get AssetFile by GUID from pre-loaded package cache Returns null if not found or package not pre-loaded

Parameters

Name Type Description
assetId System.Int32
guid System.String

Returns

AssetInventory.AssetFile — No return description is available.

public bool HasPackageCache(int assetId)

Check if package files have been pre-loaded

Parameters

Name Type Description
assetId System.Int32

Returns

System.Boolean — No return description is available.

TryGetMaterializedPath(string, out string)

Section titled “TryGetMaterializedPath(string, out string)”
public bool TryGetMaterializedPath(string key, out string path)

Try to get cached materialized path

Parameters

Name Type Description
key System.String
path System.String

Returns

System.Boolean — No return description is available.

public void StoreMaterializedPath(string key, string path)

Store materialized asset path

Parameters

Name Type Description
key System.String
path System.String
public void InvalidateMaterializedPath(string key)

Remove a cached materialized path entry, e.g. when validation discovers the import at that path is broken (missing nested prefab references).

Parameters

Name Type Description
key System.String
public DependencyResultCache.CacheStatistics GetStatistics()

Get cache statistics for debugging/logging

Returns

AssetInventory.DependencyResultCache.CacheStatistics — No return description is available.

public void Clear()

Clear all caches

public DependencyResultCache()

No description is available for this member.