Expand description
Unified caching system for VT Code
This module provides a consolidated caching framework that replaces the multiple duplicate cache implementations throughout the codebase.
Uses interior mutability with RwLock to allow &self methods,
following the pattern from matklad’s “Caches in Rust” article.
Structs§
- Cache
Entry - Cache entry with metadata
- Cache
Stats - Cache statistics with consistent structure across all cache types
- Context
Aware Cache - Context-aware cache that limits results to MAX_CONTEXT_ITEMS
- Unified
Cache - Unified cache backend with configurable eviction policies
Enums§
Constants§
- DEFAULT_
CACHE_ TTL - Default TTL for cache entries (2 minutes for memory-constrained environments)
- DEFAULT_
MAX_ CACHE_ CAPACITY - Default maximum cache capacity (reduced from 10,000 to 1,000 for memory efficiency)
- MAX_
CONTEXT_ ITEMS - Maximum number of items to return in context-limited operations
Traits§
- Cache
Key - Unified cache key trait for all cache types
- Cache
Value - Unified cache value trait
Functions§
- create_
cache_ key - Helper function to create cache key from serializable data
- estimate_
json_ size - Helper function to estimate JSON value size without allocation