Module builder

Module builder 

Source
Expand description

Cache System Builder

Provides a flexible builder pattern for constructing CacheSystem with custom backends.

§Example: Using Default Backends

use multi_tier_cache::CacheSystemBuilder;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let cache = CacheSystemBuilder::new()
        .build()
        .await?;
    Ok(())
}

§Example: Custom L1 Backend

use multi_tier_cache::{CacheSystemBuilder, CacheBackend};
use std::sync::Arc;

let custom_l1 = Arc::new(MyCustomL1Cache::new());

let cache = CacheSystemBuilder::new()
    .with_l1(custom_l1)
    .build()
    .await?;

Structs§

CacheSystemBuilder
Builder for constructing CacheSystem with custom backends