[go: up one dir, main page]

write_with_algo

Function write_with_algo 

Source
pub async fn write_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, indexing it under key. Use this function to customize the hashing algorithm.

ยงExample

use async_attributes;

#[async_attributes::main]
async fn main() -> cacache::Result<()> {
    cacache::write_with_algo(cacache::Algorithm::Xxh3, "./my-cache", "my-key", b"hello").await?;
    Ok(())
}