Skip to content

Introduction

kache is a drop-in RUSTC_WRAPPER that caches Rust compilation artifacts. Cache keys are blake3 hashes of normalized rustc invocations; cache hits restore via hardlinks, and identical blobs are stored once and shared. Optional S3 sync (AWS, Ceph, MinIO, R2) shares the cache across machines.

Local caching and direct S3 sync are stable today.

SOON: a remote planner that prefetches from workspace manifests, dependency history, and build intent — warming the right artifacts before rustc asks for them. See Remote service.

kache: cold build populates the store, then cargo clean && cargo build restores every artifact via hardlinks

Cold compile populates kache's store, cargo clean wipes target/, and the second build pulls every artifact back via hardlinks.

Why local kache is fast

kache is useful even before remote cache is configured:

  • Hardlinked restores. Local hits are restored with hardlinks into target/, so artifact bytes are not copied.
  • Content-addressed storage. The store is keyed by blake3 hash, so identical artifact blobs are stored once and linked many times.
  • Compile-then-record on misses. Misses compile normally, then kache records the outputs for future builds.
  • Daemon-optional locally. If the daemon is not running, local hits and misses still work; remote checks, uploads, and prefetching degrade gracefully.
  • Safer on macOS. Incremental compilation is disabled while kache wraps rustc — artifact caching replaces that path and avoids APFS-related corruption.

Try it

# install
mise use -g github:kunobi-ninja/kache@latest

# interactive setup: cargo wrapper + login service + daemon start
kache init

# verify
kache doctor

kache init is idempotent — re-run it any time to repair configuration. Prefer to wire things by hand? Just export RUSTC_WRAPPER=kache or set rustc-wrapper = "kache" under [build] in ~/.cargo/config.toml.

Architecture in one screen

  • WrapperRUSTC_WRAPPER intercepts rustc calls, computes blake3 cache keys, restores hits via hardlinks.
  • Daemon — background process handles async S3 uploads, remote checks, and prefetch. Auto-restarts on binary update.
  • Store — SQLite index plus content-addressed blobs under {cache_dir}/store/; hits hardlink those blobs into target/.
  • Cache keys — deterministic blake3 hash of rustc version, crate name, source, dependencies, and normalized flags — portable across machines.
Available for:
Apple macOS logomacOSMicrosoft Windows logoWindowsLinux logoLinux
Download Kunobi