Skip to main content

Module record_cache

Module record_cache 

Source
Expand description

On-disk cache of parsed schema records.

Parsing dominates the fuzzy path on a large schema (~28ms of a ~45ms query at 48k records for SDL; more for introspection JSON), and the records depend only on the source bytes โ€” SDL text or an introspection response โ€” so cache them keyed by a hash of those bytes. Same idea and same house format rules as the vector cache: a small length-prefixed binary layout, dependency-free. A miss (schema edited, format bumped) simply re-parses and overwrites.

Functionsยง

clear
Delete every record cache file; returns how many were removed.
load
Cached records for this source (SDL text or introspection JSON bytes), or None on any miss (absent, stale magic, corrupt).
store
Write records for this source (best-effort โ€” a cache write failure is never fatal), then prune the least-recently-used files.