Function cacache::remove

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

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

§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("./my-cache", "my-key").await?;

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

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

    Ok(())
}