Expand description
Process-wide canonical-path cache.
Keyed by lexical input path; value is the result of dunce::canonicalize.
Hits skip the syscall; misses run it and cache the result.
The fs-scope security gate (Environment::Utility::PathSecurity)
canonicalises every incoming path on every call. The same paths recur
thousands of times during boot - 113 extension manifest paths, ~80 chunked
workbench JS imports, ~60 git-extension scope checks, every
vscode-file:// request - so collapsing repeats to a hash lookup saves
~150 ms cumulative on the boot path.
TTL = 60 s to bound staleness against external mv/rename. moka’s
time_to_idle resets on each access, so hot paths stay cached
indefinitely while one-shot paths evict naturally.
Modules§
- Cache 🔒
- Process-global canonical-path cache backing store.
- Cache
Stats - Diagnostic snapshot of the canonical-path cache.
- Canonicalize
- Canonicalise via the cache. Returns the cached entry on hit; runs
dunce::canonicalizeon miss and caches the result. - Canonicalize
Uncached - Canonicalise without caching. For one-shot calls where the result is immediately discarded - avoids polluting the cache with paths that won’t be repeated.
- Clear
- Clear the entire path-canon cache. Diagnostic / shutdown use.
- Invalidate
- Force-evict an entry. Called from
notifywatchers when a path rename is observed inside the workspace, or by the dev-mode hot-reload signal. - Spawn
Diagnostic Logger - Spawn a tokio task that logs cache stats every 30 s under the
path-canontrace tag. Optional; call fromRunTime::Setupwhen the user hasTrace=path-canonenabled. - Stats
- Capture a diagnostic snapshot of the cache.