Function cacache::clear_sync
source · pub fn clear_sync<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::Result<()> {
let sri = cacache::write_sync("./my-cache", "my-key", b"hello")?;
cacache::clear_sync("./my-cache")?;
// These all fail:
cacache::read_sync("./my-cache", "my-key")?;
cacache::read_hash_sync("./my-cache", &sri)?;
cacache::metadata_sync("./my-cache", "my-key")?;
Ok(())
}