A bounded RAM + SSD cache for large file chunks.
C² (cache2) provides disposable acceleration in front of an authoritative data source. It combines a sharded in-memory cache with batched SSD writes, a fixed-size L2 index, and independent read, write, and reclaim I/O capacity. Cache-owned memory and request admission have explicit bounds.
A validated hit may be stale, and pressure may produce a miss or overload. Use versioned keys when freshness matters and keep the authoritative path available.
[dependencies]
cache2 = "0.6"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }Start with the integration example or the crate documentation. Both cover opening a cache, filling and reading values, and shutting down. C² requires Rust 1.98.0 and supports 64-bit Linux and macOS; buffered POSIX I/O is the default, with Linux Direct I/O and experimental io_uring available explicitly.
| I want to… | Read |
|---|---|
| Integrate a cache | Getting started — example, cache semantics, and runtime binding. |
| Size storage, memory, and concurrency | Configuration — budgets, interactions, and tuning. |
| Deploy, restart, and monitor | Operating a cache — lifecycle, health, metrics, and logs. |
| Handle pressure and failures | Error handling — classifications, policies, and diagnostics. |
| Look up a type or method | API reference — contracts and examples. |
| Understand the implementation | Architecture — data structures and invariants. |
| Qualify performance | Validation — workloads and Linux NVMe qualification. |
| Upgrade a deployment | Changelog — release changes and migration guidance. |
The guides live with the library so that they are also available in its published source package. The API reference includes a self-contained introduction and links to the relevant public contracts.
The workspace separates the publishable library, integration tests, benchmarks, examples, and repository tooling. See Contributing for setup and workflows.
cargo x check
cargo x test
cargo x lintLicensed under the Apache License, Version 2.0.