Skip to main content

Module cache

Module cache 

Source
Expand description

Cache for generator output (DESIGN.md §5.11.3, Q13).

Caching is opt-in: a generator returns Some(CacheKey) from cache_key() to participate. The cache lives on the crate::CompletionRegistry; the pipeline consults it before invoking a generator’s generate().

The cache stores Vec<RawCandidate> (the post-generate set, pre-match). The matcher / ranker / annotators always run against current state – only generation is cached. This is the right granularity: re-walking the registry for every keystroke is the expensive op; matching against ~100 cached candidates is cheap.

Structs§

GeneratorCache
Generator cache. Held inside the registry; owned by the registry because cache invalidation hooks into registry mutations (registering a new command bumps the commands generator’s version, naturally invalidating cached entries via the new key).