cacache

Function write_sync_with_algo

Source
pub fn write_sync_with_algo<P, D, K>(
    algo: Algorithm,
    cache: P,
    key: K,
    data: D,
) -> Result<Integrity>
where P: AsRef<Path>, D: AsRef<[u8]>, K: AsRef<str>,
Expand description

Writes data to the cache synchronously, indexing it under key. Use this to customize the hashing algorithm.

ยงExample

use std::io::Read;

fn main() -> cacache::Result<()> {
    let data = cacache::write_sync_with_algo(cacache::Algorithm::Xxh3, "./my-cache", "my-key", b"hello")?;
    Ok(())
}