cacache

Function remove_hash_sync

Source
pub fn remove_hash_sync<P: AsRef<Path>>(cache: P, sri: &Integrity) -> Result<()>
Expand description

Removes an individual content entry synchronously. Any index entries pointing to this content will become invalidated.

ยงExample

use std::io::Read;

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

    cacache::remove_hash_sync("./my-cache", &sri)?;

    // These fail:
    cacache::read_sync("./my-cache", "my-key")?;
    cacache::read_hash_sync("./my-cache", &sri)?;

    // But this succeeds:
    cacache::metadata_sync("./my-cache", "my-key")?;

    Ok(())
}