Module backends

Module backends 

Source
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 cache
  • QuickCache - 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?;  // RedisCache

Re-exports§

pub use dashmap_cache::DashMapCache;
pub use moka_cache::MokaCache;
pub use moka_cache::MokaCacheConfig;
pub use redis_cache::RedisCache;

Modules§

dashmap_cache
DashMap Cache - Simple Concurrent HashMap Backend
moka_cache
Moka Cache - In-Memory Cache Backend
redis_cache
Redis Cache - Distributed Cache Backend

Type Aliases§

L1Cache
Type alias for MokaCache (default L1 backend)
L2Cache
Type alias for RedisCache (default L2 backend)