Expand description
Cache Backend Implementations
This module contains all cache backend implementations for the multi-tier cache system.
§Available Backends
§In-Memory (L1 Tier)
- Moka - High-performance concurrent cache with automatic eviction (default L1)
DashMap- Simple concurrent HashMap-based cacheQuickCache- Lightweight, optimized for maximum performance (feature:backend-quickcache)
§Distributed (L2 Tier)
- Redis - Industry-standard distributed cache with persistence (default L2)
- Memcached - Lightweight distributed cache (feature:
backend-memcached)
§On-Disk (L3/L4 Tier)
RocksDB- Embedded persistent key-value store (coming soon)
§Usage
use multi_tier_cache::backends::{MokaCache, RedisCache};
// Explicit backend selection
let moka = MokaCache::new()?;
let redis = RedisCache::new().await?;
// Or use type aliases for backward compatibility
use multi_tier_cache::backends::{L1Cache, L2Cache};
let l1 = L1Cache::new()?; // MokaCache
let l2 = L2Cache::new().await?; // RedisCacheRe-exports§
pub use dashmap_cache::DashMapCache;pub use moka_cache::MokaCache;pub use moka_cache::MokaCacheConfig;pub use redis_cache::RedisCache;
Modules§
- dashmap_
cache DashMapCache - Simple ConcurrentHashMapBackend- moka_
cache - Moka Cache - In-Memory Cache Backend
- redis_
cache - Redis Cache - Distributed Cache Backend