Skip to content

Latest commit

 

History

645 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Bench Crates.io Documentation

Kache

Kache is a local-first compiler cache for Rust and C/C++. It stores build outputs by content, reuses them across worktrees, and can copy them to S3-compatible or filesystem remotes.

Try it without changing your setup

Install Kache:

cargo install kache

Run two clean builds from a Rust project:

RUSTC_WRAPPER=kache cargo build
cargo clean
KACHE_PROGRESS=hits RUSTC_WRAPPER=kache cargo build
kache stats

cargo clean is only for this demonstration. Kache normally helps when Cargo would otherwise compile an input it has seen before, such as in another worktree or after changing toolchains and changing back.

The commands above do not edit Cargo configuration or install a service. To keep Kache enabled:

kache init

Review the proposed changes without applying them:

kache init --check

Use kache init --no-service if you want persistent Cargo configuration without an OS service.

What Kache caches

Workload Status Notes
Rust libraries and build scripts Supported Use RUSTC_WRAPPER=kache or kache init
Rust executables Supported on Linux and macOS Disabled by default on Windows
C and C++ object files Supported Use compiler shims or set the compiler launcher
Local storage Built in Content-addressed store with garbage collection
S3-compatible remote storage Built in Includes AWS S3, MinIO, and Cloudflare R2
Filesystem remote storage Built in Useful for shared disks and CI volumes

Need to choose between compiler caches? Read Kache or sccache?.

Tested nightly on real projects

The scheduled benchmark workflow runs real cold/warm builds of Firefox, LLVM, Substrate, SurrealDB, Lance, and OpenDAL on Linux, compares Firefox with sccache, and exercises Firefox on Windows. It also measures how much of a Firefox build survives a source update.

Each run checks its own measurement validity and uploads reports, traces, and logs for 30 days. Treat timing or hit-rate numbers as evidence only when the individual job succeeds and its benchmark verdict is ok.

CI

The official action installs Kache and wires it into the build:

- uses: kunobi-ninja/kache-action@v1

- run: cargo build --locked

See the CI guide for GitHub Actions and shell-based CI examples.

C and C++

On Unix, install compiler-name shims and put that directory first in PATH. Make, CMake, autotools, and Arch PKGBUILDs that call gcc by name then go through Kache. No CC= edit and no shell wrapper.

kache install-shims
export PATH="$HOME/.local/lib/kache/shims:$PATH"

APT and AUR packages install /usr/lib/kache. Nix puts the same farm in $out/lib/kache. kache init can create the user farm; it does not change PATH. For makepkg, put the same assignment in ~/.makepkg.conf. Wrap extra names already on PATH with kache install-shims --from-path.

Kache inspects the real compiler invocation. Unsupported or unsafe invocations pass through. See C and C++.

Storage and remotes

The default local cache is:

  • Linux: $XDG_CACHE_HOME/kache or ~/.cache/kache
  • macOS: ~/Library/Caches/kache
  • Windows: %LOCALAPPDATA%\kache

Open the configuration editor with kache config, or edit the TOML file directly. A minimal S3-compatible remote looks like this:

[cache.remote]
type = "s3"
bucket = "my-build-cache"
region = "us-east-1"

Credentials come from the standard AWS environment variables or credential chain. See S3 setup and filesystem setup.

Useful commands

kache monitor                 # live build and cache activity
kache stats                   # non-interactive summary
kache doctor                  # setup and integrity checks
kache install-shims           # Unix compiler-name PATH farm
kache why-miss <crate>        # explain the latest miss
kache list                    # inspect cached entries
kache gc                      # enforce cache limits
kache sync                    # pull from and push to the configured remote
kache daemon status           # inspect the background service

Run kache help <command> for exact flags. The command reference covers every top-level command.

Documentation

Questions and gaps

Development

git clone https://github.com/kunobi-ninja/kache.git
cd kache
cargo test --workspace --all-features

See CONTRIBUTING.md before opening a pull request.

Kache is licensed under the Apache License 2.0.

About

Zero-copy, content-addressed Rust build cache for Rust, C/C++ and more. No copies, no wasted disk — just hardlinks locally and S3 for sharing.

Topics

Resources

Contributing

Security policy

Stars

626 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages