Function cacache::remove_sync

source ·
pub fn remove_sync<P, K>(cache: P, key: K) -> Result<()>
where P: AsRef<Path>, K: AsRef<str>,
Expand description

Removes an individual index entry synchronously. The associated content will be left in the cache.

Example

use std::io::Read;

fn main() -> cacache::Result<()> {
    let sri = cacache::write_sync("./my-cache", "my-key", b"hello")?;

    cacache::remove_sync("./my-cache", "my-key")?;

    // This fails:
    cacache::read_sync("./my-cache", "my-key")?;

    // But this succeeds:
    cacache::read_hash_sync("./my-cache", &sri)?;

    Ok(())
}