Skip to main content

Module record_cache

Module record_cache 

Source
Expand description

On-disk cache of parsed schema records.

Parsing a large SDL file dominates the fuzzy path (~28ms of a ~45ms query on a 48k-record schema), and the records depend only on the SDL text — so cache them keyed by a hash of it. 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 SDL text, or None on any miss (absent, stale magic, corrupt).
store
Write records for this SDL text (best-effort — a cache write failure is never fatal), then prune the least-recently-used files.