Skip to main content

Module schema_cache

Module schema_cache 

Source
Expand description

Schema caching. Schema caching for JSON to HEDL conversion

When converting large JSON arrays to matrix lists, we often encounter the same structure repeatedly. Caching the inferred schema significantly improves performance by avoiding redundant key iteration and sorting.

§Performance Impact

  • First schema inference: ~O(n*log(n)) where n is number of keys
  • Cached lookup: ~O(1) hash map lookup
  • Expected speedup: 30-50% for documents with repeated array structures

§Thread Safety

The cache is thread-safe using interior mutability with RwLock. Multiple threads can read from the cache concurrently, while writes are exclusive.

Structs§

CacheStatistics
Statistics for cache performance monitoring
SchemaCache
Thread-safe LRU schema cache
SchemaCacheKey
Cache key for schema lookup