[go: up one dir, main page]

read_sync

Function read_sync 

Source
pub fn read_sync<P, K>(cache: P, key: K) -> Result<Vec<u8>>
where P: AsRef<Path>, K: AsRef<str>,
Expand description

Reads the entire contents of a cache file synchronously into a bytes vector, looking the data up by key.

ยงExample

use std::io::Read;

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