kvarn::read

Function file_cached

source
pub async fn file_cached<P: AsRef<str>>(
    path: P,
    cache: Option<&FileCache>,
) -> Option<Bytes>
Expand description

Reads a file using a cache. Should be used instead of fs::File::open().

Should only be used when a file is typically access several times or from several requests.