llm_config_cache/
lib.rs

1//! Multi-tier caching for LLM Config Manager
2//!
3//! This module provides a two-tier caching system:
4//! - L1 Cache: In-memory cache for ultra-fast access (LRU eviction)
5//! - L2 Cache: Persistent cache for warm restarts
6//!
7//! ## Performance Characteristics
8//! - L1 Cache: <1μs latency
9//! - L2 Cache: <1ms latency
10//! - Cache miss: 5-10ms (disk read)
11
12pub mod l1;
13pub mod l2;
14pub mod manager;
15
16pub use l1::L1Cache;
17pub use l2::L2Cache;
18pub use manager::CacheManager;
19
20use thiserror::Error;
21
22#[derive(Debug, Error)]
23pub enum CacheError {
24    #[error("IO error: {0}")]
25    Io(#[from] std::io::Error),
26
27    #[error("Serialization error: {0}")]
28    Serialization(String),
29
30    #[error("Cache miss for key: {0}")]
31    CacheMiss(String),
32
33    #[error("Eviction error: {0}")]
34    Eviction(String),
35}
36
37pub type Result<T> = std::result::Result<T, CacheError>;