[][src]Crate cacache

cacache is a Rust library for managing local key and content address caches. It's really fast, really good at concurrency, and it will never give you corrupted data, even if cache files get corrupted or manipulated.

Examples

use cacache;
let dir = tmp.path().to_owned();
cacache::put::data(&dir, "key", b"my-data").unwrap();
let data = cacache::get::read(&dir, "key").unwrap();
assert_eq!(data, b"my-data");

You can also use the equivalent async APIs using async/await!

use cacache;
let dir = tmp.path().to_owned();
cacache::async_put::data(&dir, "key", b"my-async-data").await.unwrap();
let data = cacache::async_get::read(&dir, "key").await.unwrap();
assert_eq!(data, b"my-async-data");

Modules

async_get

Functions for reading asynchronously from cache.

async_put

Functions for asynchronously writing to cache.

async_rm

Functions for asynchronously removing things from the cache.

get

Functions for reading from cache.

ls

Functions for iterating over the cache.

put

Functions for writing to cache.

rm

Functions for removing things from the cache.

Structs

Entry

Represents a cache index entry, which points to content.

Enums

Algorithm

Valid algorithms for integrity strings.

Error

Error type returned by all API calls.

Value

Represents any valid JSON value.