clear

Function clear 

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

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

ยงExample

use std::io::Read;

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

    cacache_sync::clear("./my-cache")?;

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

    Ok(())
}