Function cacache::clear

source ·
pub async fn clear<P: AsRef<Path>>(cache: P) -> Result<()>
Expand description

Removes entire contents of the cache, including temporary files, the entry index, and all content data.

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::clear("./my-cache").await?;

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

    Ok(())
}