Function cacache::remove_hash

source ·
pub async fn remove_hash<P: AsRef<Path>>(
    cache: P,
    sri: &Integrity
) -> Result<()>
Expand description

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

§Example

use async_std::prelude::*;
use async_attributes;

#[async_attributes::main]
async fn main() -> cacache::Result<()> {
    let sri = cacache::write("./my-cache", "my-key", b"hello").await?;

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

    // These fail:
    cacache::read("./my-cache", "my-key").await?;
    cacache::read_hash("./my-cache", &sri).await?;

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

    Ok(())
}