Module cache

Module cache 

Source
Expand description

Query result caching with LRU eviction

This module provides an LRU (Least Recently Used) cache for query results, significantly improving performance for repeated queries.

§Performance Impact

  • Cache hit: ~1-10μs (instant)
  • Cache miss: Full search time (~1-10ms)
  • Typical hit rate: 20-40% for production workloads

§Memory Usage

  • Each cached entry: ~(key_size + result_size) bytes
  • Default capacity: 1000 entries
  • Configurable max size

Modules§

early_termination
Early termination optimization for k-NN search

Structs§

CacheStats
Cache statistics
QueryCache
LRU cache for query results with TTL support
SharedQueryCache
Thread-safe LRU cache wrapper