rust_logic_graph/cache/
mod.rs

1//! Caching layer for node execution results
2//!
3//! This module provides a flexible caching system for storing and retrieving
4//! node execution results to avoid redundant computations.
5//!
6//! # Features
7//!
8//! - **Node Result Caching**: Store results keyed by node ID and input hash
9//! - **Cache Invalidation**: LRU, FIFO, and manual invalidation strategies
10//! - **TTL Support**: Automatic expiration of cached entries
11//! - **Memory Limits**: Configurable memory bounds with automatic eviction
12//!
13//! # Example
14//!
15//! ```no_run
16//! use rust_logic_graph::cache::{CacheManager, CacheConfig, EvictionPolicy};
17//! use std::time::Duration;
18//!
19//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
20//! let config = CacheConfig {
21//!     max_entries: 1000,
22//!     max_memory_bytes: 100 * 1024 * 1024, // 100MB
23//!     default_ttl: Some(Duration::from_secs(300)),
24//!     eviction_policy: EvictionPolicy::LRU,
25//!     enable_background_cleanup: true,
26//! };
27//!
28//! let cache = CacheManager::new(config).await?;
29//!
30//! // Cache is automatically integrated with the executor
31//! # Ok(())
32//! # }
33//! ```
34
35mod cache_manager;
36mod entry;
37mod policy;
38
39pub use cache_manager::{CacheConfig, CacheManager};
40pub use entry::{CacheEntry, CacheKey};
41pub use policy::EvictionPolicy;