use fncache::{backends::memory::MemoryBackend, fncache, init_global_cache, Result};
#[fncache(ttl = 60)]
fn compute_value(input: u32) -> u32 {
println!("Computing value for {}", input);
input * 42
}
fn main() -> Result<()> {
println!("\n--- Default Memory Backend ---");
let backend = MemoryBackend::new();
init_global_cache(backend)?;
let result1 = compute_value(10);
println!("Result 1: {}", result1);
let result2 = compute_value(10);
println!("Result 2: {}", result2);
let result3 = compute_value(20);
println!("Result 3: {}", result3);
Ok(())
}