rez_next_cache/lib.rs
1//! Intelligent caching system for rez-core
2//!
3//! This crate provides a unified, intelligent caching system that integrates
4//! with existing rez-core caches (SolverCache, RepositoryCache, RexCache).
5//! It features multi-level caching, predictive preheating, and adaptive tuning
6//! to achieve >90% cache hit rates.
7//!
8//! # Features
9//!
10//! - **Unified Cache Interface**: Common trait for all cache types
11//! - **Multi-level Caching**: L1 memory cache + L2 disk cache
12//! - **Predictive Preheating**: ML-based access pattern prediction
13//! - **Adaptive Tuning**: Real-time parameter optimization
14//! - **Performance Monitoring**: Comprehensive statistics and metrics
15//!
16//! # Architecture
17//!
18//! The caching system is built on top of existing rez-core cache implementations,
19//! reusing proven patterns and components while adding intelligent features.
20//!
21//! ```text
22//! ┌─────────────────────────────────────────────────────────────┐
23//! │ IntelligentCacheManager │
24//! ├─────────────────────────────────────────────────────────────┤
25//! │ L1 Cache (DashMap) │ L2 Cache (RepositoryCache) │
26//! ├─────────────────────────────────────────────────────────────┤
27//! │ PredictivePreheater │ AdaptiveTuner │
28//! ├─────────────────────────────────────────────────────────────┤
29//! │ SolverCache │ RepositoryCache │ RexCache │
30//! └─────────────────────────────────────────────────────────────┘
31//! ```
32
33pub mod adaptive_tuner;
34pub mod benchmarks;
35pub mod cache_config;
36pub mod cache_stats;
37pub mod error;
38pub mod intelligent_manager;
39pub mod performance_monitor;
40pub mod predictive_preheater;
41pub mod unified_cache;
42
43// Re-export core types
44pub use adaptive_tuner::*;
45pub use benchmarks::*;
46pub use cache_config::*;
47pub use cache_stats::*;
48pub use error::*;
49pub use intelligent_manager::*;
50pub use performance_monitor::*;
51pub use predictive_preheater::*;
52pub use unified_cache::*;
53
54/// Cache eviction strategies (copied from SolverCache for now)
55#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq)]
56pub enum EvictionStrategy {
57 /// Least Recently Used
58 LRU,
59 /// Least Frequently Used
60 LFU,
61 /// First In, First Out
62 FIFO,
63 /// Time-based expiration only
64 TTL,
65}
66
67/// Version information for the cache system
68pub const CACHE_VERSION: &str = env!("CARGO_PKG_VERSION");
69
70/// Default cache configuration
71pub const DEFAULT_L1_CAPACITY: usize = 10000;
72pub const DEFAULT_L2_CAPACITY: usize = 100000;
73pub const DEFAULT_TTL_SECONDS: u64 = 3600;
74pub const DEFAULT_MEMORY_LIMIT_MB: u64 = 100;
75
76#[cfg(test)]
77mod tests;