1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Copyright © 2025-2026 Wenze Wei. All Rights Reserved.
//!
//! This file is part of Ri.
//! The Ri project belongs to the Dunimd Team.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! You may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http://www.apache.org/licenses/LICENSE-2.0
//!
//! Unless required by applicable law or agreed to in writing, software
//! distributed under the License is distributed on an "AS IS" BASIS,
//! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//! See the License for the specific language governing permissions and
//! limitations under the License.
//! # Cache Backends Module
//!
//! This module provides various cache backend implementations for the Ri cache system.
//! It includes in-memory, Redis, and hybrid cache backends, allowing users to choose
//! the appropriate cache implementation based on their requirements.
//!
//! ## Available Backends
//!
//! - **RiMemoryCache**: In-memory cache implementation using DashMap for high performance
//! - **RiRedisCache**: Redis-based cache implementation for distributed systems
//! - **RiHybridCache**: Hybrid cache combining in-memory and Redis cache for optimal performance
//!
//! ## Design Principles
//!
//! 1. **Unified Interface**: All backends implement the RiCache trait for consistent usage
//! 2. **Performance Focus**: Each backend is optimized for its specific use case
//! 3. **Thread Safety**: All backends are thread-safe for concurrent access
//! 4. **Expiration Support**: Built-in support for cache entry expiration
//! 5. **Statistics**: Comprehensive cache statistics for monitoring
//! 6. **Cleanup Mechanism**: Automatic cleanup of expired entries
//! 7. **Easy Integration**: Simple API for integrating with any application
//! 8. **Extensible**: Easy to add new cache backends
//!
//! ## Usage
//!
//! ```rust
//! use ri::prelude::*;
//!
//! async fn example() -> RiResult<()> {
//! // Create an in-memory cache
//! let memory_cache = RiMemoryCache::new();
//!
//! // Create a Redis cache
//! let redis_cache = RiRedisCache::new("redis://localhost:6379").await?;
//!
//! // Create a hybrid cache
//! let hybrid_cache = RiHybridCache::new("redis://localhost:6379").await?;
//!
//! Ok(())
//! }
//! ```
/// In-memory cache backend implementation
/// Redis cache backend implementation
/// Hybrid cache backend implementation (in-memory + Redis)
/// In-memory cache implementation using DashMap for high performance
pub use RiMemoryCache;
/// Redis-based cache implementation for distributed systems
pub use RiRedisCache;
/// Hybrid cache combining in-memory and Redis cache for optimal performance
pub use RiHybridCache;