Configure Sccache Remote Storage
Last updated: September 21, 2026
What is Sccache
Sccache is a compiler wrapper that speeds up builds by caching compiler outputs and reusing them across different machines.
Sccache includes support for caching the compilation of Rust, Assembler, C/C++, NVIDIA CUDA through
nvccand clang, and AMD ROCm HIP for AI and ML.
https://github.com/mozilla/sccache#sccache---shared-compilation-cache
Sccache can use both Local disk cache and Remote Storage. Local Storage helps a single machine, Remote Storage lets teams share compilation cache across machines: CI & developer environments.
For each compiler invocation, Sccache computes a cache key from compiler identity, flags, source inputs, and environment variables, then queries its Local and Remote caches.
On a Cache Hit Sccache reuses previously stored output (fast) and skips compiler invocation. On a Cache Miss Sccache runs the compiler locally (slow), stores the outputs in shared cache and makes them available for later builds.
Schematic example: say a first build of the libs/parser module misses the cache, spends time compiling, and stores each resulting artifact under its computed key:
libs/parser (module)
Inputs
+----------------------+
| parser.rs/cpp |
| lexer.rs/cpp |
| ast.rs/cpp |
| token.rs/cpp |
| ... |
| headers, flags, ... |
| compiler identity |
+----------+-----------+
|
v
Sccache client -> local server
|
v
Compute cache key per unit
|
v
+----------------------+
| Local cache miss |
| remote storage miss |
+----------+-----------+
|
v
Compile module (~1m)
|
v
Outputs: parser.o / .rlib
|
v
Store artifacts under keyLater builds with the same inputs reuse those entries. Sccache computes the same cache keys, finds a local cache hit when possible, otherwise hits the BuildFetch remote storage, and restores the module outputs in seconds instead of recompiling.
libs/parser (same inputs)
Inputs unchanged
parser.rs/cpp · lexer.rs/cpp · ast.rs/cpp · ...
|
v
Same cache key per unit
|
v
+----------------------+
| Sccache |
| local cache: HIT |
| remote: fallback |
+----------+-----------+
|
v
Restore outputs (~100ms)
|
v
Skip ~1m compile
Build continues soonerShare Sccache Between Machines
Remote Sccache Storage
For Sccache outputs to be shared across machines, WebDAV remote storage can be configured as one of the natively supported protocol. Local cache only helps on a single machine.
BuildFetch Cache natively supports Sccache WebDAV backend and acts as an extremely fast shared remote cache for CI, engineers, and AI agents.
Remote Sccache storage lets teams share compiled outputs across engineer workstations, CI, and AI agent environments.
CI, having a more reproducible and controlled environment, typically both reads from and writes to the shared remote storage. Engineers and AI agents read those outputs without uploading new entries.
That keeps the cache warm from reproducible CI builds while reducing repeated compilation on other machines.
Sccache reuses an artifact only when compiler inputs and relevant configuration match. Keep compiler versions, flags, source inputs, and other build environment details consistent when sharing a cache.
Instead of recompiling the same translation units on every machine, Sccache restores cached artifacts, which turns builds that took minutes into cached builds that finish in seconds when hit rates are high.
Cached Sccache Build Example
First build, where there is no shared cache yet:
$ export RUSTC_WRAPPER=sccache
$ cargo build --release
Compiling parser v0.1.0
Compiling lexer v0.1.0
Compiling ast v0.1.0
...
Finished release [optimized] target(s) in 10m 4s
$ sccache --show-stats
Cache hits: 0
Cache misses: 842
Cacheable calls: 842After CI populated Sccache Remote Storage, even a clean rebuild on another machine can resolve up to 100% of slow and resource-heavy compiles from cache:
$ export RUSTC_WRAPPER=sccache
$ cargo clean && cargo build --release
Compiling parser v0.1.0
Compiling lexer v0.1.0
Compiling ast v0.1.0
...
Finished release [optimized] target(s) in 12.3s
$ sccache --show-stats
Cache hits: 831
Cache misses: 11
Cacheable calls: 842Enable Sccache
Install Sccache, then route compiler invocations through it. For Rust builds, the usual setup is setting RUSTC_WRAPPER=sccache. For other toolchains, configure your build system to invoke the compiler through Sccache.
Once compiles run through Sccache, the local cache works automatically. To share results across machines, configure Sccache remote storage with BuildFetch Cache.
Configure Sccache Remote Storage
Before setting up remote cache, ensure you have created Project and Token(s).
Official Sccache configuration documentation: https://github.com/mozilla/sccache/blob/main/docs/Configuration.md.
Sccache remote storage is configured with environment variables, or the equivalent keys in sccache.conf.
BuildFetch Project Cache Setup tab will provide:
SCCACHE_WEBDAV_ENDPOINTSCCACHE_WEBDAV_KEY_PREFIXSCCACHE_WEBDAV_USERNAMESCCACHE_WEBDAV_PASSWORD
The BuildFetch Project Cache Setup tab generates the authenticated WebDAV endpoint and the project key prefix, so your Sccache environment can point to the correct remote storage path directly.
Cache Access
Use a cache:readonly Token by default on developer and AI agent machines. Trusted environments like CI should use a cache:readwrite Token and explicitly enable uploads.
For Token management, rotation, and Open Source guidance, see Set up BuildFetch Cache Project.
Read-only
export SCCACHE_WEBDAV_ENDPOINT="https://cache.region.buildfetch.com/project-id/sccache/"
export SCCACHE_WEBDAV_KEY_PREFIX="<project-id>"
export SCCACHE_WEBDAV_USERNAME="token-auth"
export SCCACHE_WEBDAV_PASSWORD="<generated-readonly-token>"
export SCCACHE_WEBDAV_RW_MODE="READ_ONLY"Read-write
export SCCACHE_WEBDAV_PASSWORD="<generated-readwrite-token>"
export SCCACHE_WEBDAV_RW_MODE="READ_WRITE"Export these variables in the shell or CI environment used for compilation, then run your build through Sccache. Use statistics to confirm the cache is active:
$ export RUSTC_WRAPPER=sccache
$ sccache --zero-stats
$ cargo build --release
$ sccache --show-stats