10 releases (6 major breaking)

✓ Uses Rust 2018 edition

6.0.0 Nov 12, 2019
5.0.0 Oct 24, 2019
4.0.0 Oct 21, 2019
3.0.0 Oct 19, 2019
0.1.0 Jun 6, 2019

#8 in Caching

Download history 7/week @ 2019-07-29 20/week @ 2019-08-05 2/week @ 2019-08-12 6/week @ 2019-08-19 51/week @ 2019-08-26 23/week @ 2019-09-02 6/week @ 2019-09-09 43/week @ 2019-09-16 15/week @ 2019-09-23 8/week @ 2019-09-30 41/week @ 2019-10-14 79/week @ 2019-10-21 23/week @ 2019-10-28 13/week @ 2019-11-04

104 downloads per month

Custom license

86KB
1.5K SLoC

cacache

A high-performance, concurrent, content-addressable disk cache, optimized for async APIs.

Example

use cacache;
use async_attributes;

#[async_attributes::main]
async fn main() -> Result<(), cacache::Error> {
    let dir = String::from("./my-cache");

    // Write some data!
    cacache::write(&dir, "key", b"my-async-data").await?;

    // Get the data back!
    let data = cacache::read(&dir, "key").await?;
    assert_eq!(data, b"my-async-data");

    // Clean up the data!
    cacache::rm::all(&dir).await?;
}

Install

Using cargo-edit

$ cargo add cacache

Documentation

Features

  • First-class async support, using async-std as its runtime. Sync APIs are available but secondary
  • std::fs-style API
  • Extraction by key or by content address (shasum, etc)
  • Subresource Integrity web standard support
  • Multi-hash support - safely host sha1, sha512, etc, in a single cache
  • Automatic content deduplication
  • Atomic content writes even for large data
  • Fault tolerance (immune to corruption, partial writes, process races, etc)
  • Consistency guarantees on read and write (full data verification)
  • Lockless, high-concurrency cache access
  • Really helpful, contextual error messages
  • Large file support
  • Pretty darn fast
  • Arbitrary metadata storage
  • Cross-platform: Windows and case-(in)sensitive filesystem support
  • Punches nazis

Contributing

The 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!

License

This project is licensed under the Parity License. Third-party contributions are licensed under Apache-2.0 and belong to their respective authors.

The Parity License is a copyleft license that, unlike the GPL family, allows you to license derivative and connected works under permissive licenses like MIT or Apache-2.0. It's free to use provided the work you do is freely available!

For proprietary use, please contact me, or just sponsor me on GitHub under the appropriate tier to acquire a proprietary-use license! This funding model helps me make my work sustainable and compensates me for the work it took to write this crate!

Dependencies

~7MB
~138K SLoC