kache 1.2.2

Compiler cache for Rust, C/C++ and CUDA, with S3, GCS, shared-filesystem and OCI remotes.
kache-1.2.2 is not a library.

CI Bench Crates.io Documentation

Kache

Build once. Reuse the work.

Kache is a compiler cache for Rust, C/C++, and CUDA on Linux, macOS, and Windows. It restores matching compiler outputs across worktrees and CI runs, so you spend less time rebuilding and less disk space storing the same bytes.

Built by Kunobi.

Get started · Benchmarks · Kache vs sccache · CI setup

Install

cargo install kache --locked
kache init

kache init shows the changes before applying them. It configures Cargo's compiler wrapper and offers a background service. On Unix it also sets up C/C++ compiler shims. Run kache init --check for a preview.

Then use Cargo as usual in your project. Kache caches eligible compiler work automatically.

Cargo installation needs Rust 1.95 or newer. Prefer a prebuilt package? Homebrew, APT, AUR, Windows packages, mise, and Nix →

See it reuse a build

Build the same revision in two worktrees with separate target directories. The second can restore compatible outputs from the first. Try the walkthrough.

View the still image.

A new cache needs a build to fill it. Reuse requires matching inputs, toolchain, and build settings. Unsupported compiler invocations run normally. What can be cached →

Why use Kache?

  • Reuse eligible Rust libraries, executables, and build scripts across worktrees. It also caches GCC, Clang, clang-cl, and single-source CUDA object compilations.
  • Keep identical output bytes once in a cache with a disk budget. On filesystems with copy-on-write cloning, restored outputs share disk blocks with the cache.
  • Run builds together. Compiles with the same cache key share one in-flight build, while the scheduler paces compiler processes.
  • Share work through S3-compatible storage, Google Cloud Storage, a shared filesystem, or an OCI registry. The local cache works on its own.
  • See what happened. Inspect hits and misses, then ask kache explain what changed.

Four Firefox worktrees sharing cached outputs through copy-on-write clones.

Rust executables and build-script runs are cached by default on Linux and macOS. See platform support and caching limits for Windows and other workload details.

Less disk per worktree

A measured second Firefox worktree adds about 3 GB with Kache on APFS, compared with 16.7 GB with sccache.

In a Firefox 151 benchmark with Kache 0.7.0 on macOS/APFS, the second worktree added about 3 GB of new data. Read the measurements and methodology →

Nightly workflows measure cold and warm builds of real projects, including Firefox, LLVM, and SurrealDB. Browse the benchmark reports to see the workload, platform, and validation behind each result.

Watch a build and explain a miss

kache monitor             # live build and cache activity
kache stats --last-build  # latest recorded build session
kache explain             # why the latest build missed
kache doctor              # check your setup

View the still image.

See the current dashboard and controls →

Add it to CI

Install your Rust toolchain, then add the official action before your build:

- uses: kunobi-ninja/kache-action@v1
- run: cargo build --locked

The action can persist the local store through GitHub's cache service. For remote storage, credentials, and pull-request policy, follow the CI guide.

Star History

Find your next step

I want to… Guide
Confirm my first cache hits Quick start
Cache Make, CMake, or CUDA builds C/C++ · CUDA
Share a cache between machines Remote cache
Change storage limits or build policy Configuration
Investigate unexpected misses Troubleshooting
Understand cache keys and correctness How it works
Look up a command or flag Command reference

Help improve Kache

Report a bug, request a feature, or read CONTRIBUTING.md to contribute.

Licensed under Apache 2.0.