Skip to main content

imc_remove

Function imc_remove 

Source
pub fn imc_remove<T: ImcCacheable>(id: &T::Id)
Expand description

Remove a single entry by its unique Id.

After removal, the next through_imc call for that identity will re-execute the closure and cache the fresh value.

ยงExample

use std::time::Duration;
use imc::{ImcCacheable, CacheStrategy, through_imc, imc_remove};

let u: User = through_imc(42u32, || User { id: 42, name: "Alice".into() });
assert_eq!(u.name, "Alice");

imc_remove::<User>(&42);

// Next call re-executes the closure:
let u2: User = through_imc(42u32, || User { id: 42, name: "Alice Updated".into() });
assert_eq!(u2.name, "Alice Updated");