Skip to main content

Module resolver_cache

Module resolver_cache 

Source
Expand description

Resolver response cache (docs/CACHE.md §1–3).

Caches the MetadataOnlyOutcome of a resolve at <cache_root>/resolver/<safekey>.toml so a repeat resolve of the same ref within the TTL (crate::RESOLVER_CACHE_TTL_DAYS, 7 days) is served from disk instead of hitting Crossref / arXiv. This is the mechanism by which doiget verify avoids upstream rate limits: in CI the directory is persisted across runs (e.g. actions/cache), so an unchanged bibliography resolves with zero network calls.

The on-disk entry follows CACHE.md §2: a TOML file with schema_version / fetched_at / ttl_seconds / source, plus the resolver outcome stored as a JSON string under response (the MetadataOnlyOutcome.metadata field is arbitrary JSON that does not round-trip cleanly through TOML, so it is kept as a JSON blob).

All operations are best-effort: a read miss, a stale entry, a parse error, or a write failure degrade to “no cache” rather than failing the resolve. The cache is a latency/politeness optimisation, never a correctness dependency.