Reference
Cache.
How the cache works
ngcompass uses a two-layer cache: an in-memory LRU layer and a disk layer backed by cacache.
Results are stored per task (file × rule) and keyed on a hash of the file content. When a file hasn't changed since the last run, its cached results are replayed without re-parsing or re-running rules. A global full-run hash is also stored to detect config and rule changes.
The cache TTL is 24 hours by default. Configure it via the cache.ttl option in ngcompass.config.ts.
Commands
Show cache status and statistics:
01npx ngcompass cache infoClear the cache:
01npx ngcompass cache clearClear a specific cache type:
01npx ngcompass cache clear --type ast02npx ngcompass cache clear --type config03npx ngcompass cache clear --type results04npx ngcompass cache clear --type allPrint the cache directory path:
01npx ngcompass cache pathSkip the cache for a single run
01npx ngcompass analyze --forceBypasses the cache for the current run. Results are not written back to the cache.
Cache configuration
01cache: {02 enabled: true,03 strategy: 'local', // 'memory' | 'local'04 location: 'node_modules/.cache/ngcompass',05 ttl: 86400000, // 24 hours in ms06},enabledbooleanEnable or disable caching. Default: true.
strategy"memory" | "local""local" writes to disk via cacache. "memory" keeps results in-process only (lost between runs).
locationstringCache directory path. Default: node_modules/.cache/ngcompass.
ttlnumberTime-to-live in milliseconds. Default: 86400000 (24 hours).
Caching in CI
Cache the default cache directory between CI runs to speed up analysis. The default location is node_modules/.cache/ngcompass.
01- uses: actions/cache@v402 with:03 path: node_modules/.cache/ngcompass04 key: ngcompass-${{ hashFiles('src/**/*.ts') }}