Coder Social home page Coder Social logo

pawurb / cacache-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zkat/cacache-rs

0.0 1.0 0.0 416 KB

A high-performance, concurrent, content-addressable disk cache, with support for both sync and async APIs. ๐Ÿ’ฉ๐Ÿ’ต but for your ๐Ÿฆ€

Home Page: https://crates.io/crates/cacache

License: Other

Rust 99.35% Just 0.65%

cacache-rs's Introduction

cacache CI crates.io

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

Minimum supported Rust version is 1.43.0.

Documentation

Features

  • First-class async support, using either async-std or tokio as its runtime. Sync APIs are available but secondary. You can also use sync APIs only and remove the async runtime dependency.
  • 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
  • miette integration for detailed, helpful error reporting.
  • Punches nazis

async-std is the default async runtime. To use tokio instead, turn off default features and enable the tokio-runtime feature, like this:

[dependencies]
cacache = { version = "*", default-features = false, features = ["tokio-runtime", "mmap"] }

You can also remove async APIs altogether, including removing async runtime dependency:

[dependencies]
cacache = { version = "*", default-features = false, features = ["mmap"] }

Experimental support for symlinking to existing files is provided via the "link_to" feature.

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!

MSRV

The Minimum Supported Rust Version for cacache is 1.67.0. Any changes to the MSRV will be considered breaking changes.

License

This project is licensed under the Apache-2.0 License.

cacache-rs's People

Contributors

zkat avatar komar007 avatar ceejbot avatar 06chaynes avatar andir avatar uhhhwaitwhat avatar passcod avatar kinire98 avatar jkbecker avatar theawiteb avatar fiag avatar redmar avatar shaug avatar rickycodes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.