Skip to main content

Module schema_cache

Module schema_cache 

Source
Expand description

§Schema Cache

Opt-in in-memory cache for collection schema metadata (primary_key_alias, fields, version). Eliminates redundant schema API calls for ID extraction and field validation.

§Features

  • LRU eviction: bounded memory — oldest entries evicted when capacity exceeded
  • TTL expiry: entries go stale after configurable duration (default 5 min)
  • Realtime invalidation: handle_schema_changed() for WS/SSE push events
  • Thread-safe: Mutex-protected HashMap/VecDeque (low contention, no extra deps)
  • Fast guard when disabled: lookups and inserts short-circuit via enabled flag

Structs§

CachedSchema
Cached schema metadata for a single collection.
SchemaCache
Thread-safe, opt-in schema cache with LRU eviction and TTL expiry.
SchemaCacheConfig
Configuration for the schema cache.