Ragex.Analysis.Cache
(Ragex v0.9.1)
View Source
Persistence layer for code analysis results (issues).
Caches issue discovery results (dead code, security, smells, duplicates, etc.) alongside file fingerprints. On load, compares stored fingerprints with current file state to determine cache freshness.
Data is stored at ~/.cache/ragex/<project_hash>/analysis.etf.
Usage
# Save analysis results
:ok = Analysis.Cache.save(issues, "/path/to/project")
# Load cached results (validates freshness)
{:ok, issues} = Analysis.Cache.load("/path/to/project")
{:stale, cached_issues, changed_files} = Analysis.Cache.load("/path/to/project")
# Check cache freshness
Analysis.Cache.fresh?("/path/to/project")
Summary
Functions
Clears the analysis cache.
Checks if the analysis cache is fresh (all files unchanged).
Loads cached analysis results and validates freshness.
Saves analysis results to disk with file fingerprints.
Returns statistics about the analysis cache.
Functions
@spec clear(String.t() | nil) :: :ok
Clears the analysis cache.
Checks if the analysis cache is fresh (all files unchanged).
Loads cached analysis results and validates freshness.
Parameters
path- Project path to validate against
Returns
{:ok, issues}- Cache is fresh, all files unchanged{:stale, issues, changed_files}- Some files changed, returns cached issues + list of changed files{:error, :not_found}- No cache exists{:error, reason}- Failure
Saves analysis results to disk with file fingerprints.
Parameters
issues- Map of issue categories to their resultspath- Project path that was analyzed
Returns
:ok- Saved successfully{:error, reason}- Failure
Returns statistics about the analysis cache.