Crates.io | cacache-sync |
lib.rs | cacache-sync |
version | 11.0.0 |
source | src |
created_at | 2023-01-24 15:45:39.100649 |
updated_at | 2023-01-24 15:45:39.100649 |
description | Synchronous, content-addressable, key-value, high-performance, on-disk cache. |
homepage | https://github.com/kade-robertson/cacache-rs-sync |
repository | https://github.com/kade-robertson/cacache-rs-sync |
max_upload_size | |
id | 766763 |
size | 98,835 |
A high-performance, concurrent, content-addressable disk cache, with only sync APIs.
This is a fork of the cacache
crate here: https://github.com/zkat/cacache-rs,
which removes all async code and dependencies, and makes the sync APIs the
primary usage (no need for _sync
suffixes).
The motivation is pretty simple -- in another project I was using cacache
,
where I only relied on the sync API. I seem to still be paying the cost of
having async-related dependencies, so this fork is mostly for people who are
definitely only going to be using the sync APIs. I'm not sure how translatable
these savings are across other projects, but compile times for debug builds
dropped by ~33%.
This fork is likely going to be minimally supported -- I don't see much needing to change about the sync implementations here. If you want to see changes here, you should probably push those to the original project (and consider supporting it as well).
use cacache_sync;
async fn main() -> Result<(), cacache_sync::Error> {
let dir = String::from("./my-cache");
// Write some data!
cacache_sync::write(&dir, "key", b"my-async-data")?;
// Get the data back!
let data = cacache_sync::read(&dir, "key")?;
assert_eq!(data, b"my-async-data");
// Clean up the data!
cacache_sync::clear(&dir)?;
}
Using cargo-edit
$ cargo add cacache-sync
Minimum supported Rust version is 1.66.1
.
std::fs
-style APIThe cacache team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The Contributor Guide has all the information you need for everything from reporting bugs to contributing entire new features. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.
All participants and maintainers in this project are expected to follow Code of Conduct, and just generally be excellent to each other.
Happy hacking!
This project is licensed under the Apache-2.0 License.