sccache S3 and Redis Backends
sccache can back its cache with S3-compatible object storage or Redis so many runners and developers share hits.
For a team or a fleet of runners, a shared sccache backend means the first build to compile a translation unit warms it for everyone. S3-compatible stores (AWS, MinIO, R2) and Redis are the common choices.
What it does
Setting SCCACHE_BUCKET (and optionally SCCACHE_ENDPOINT/SCCACHE_REGION) selects an S3-compatible backend; SCCACHE_REDIS selects a Redis backend via a connection URL. sccache then stores and fetches objects there instead of local disk, so the cache is shared across machines. Credentials come from the usual AWS environment or the Redis URL.
Common usage
# S3-compatible backend
export SCCACHE_BUCKET=my-sccache-bucket
export SCCACHE_REGION=us-east-1
export SCCACHE_ENDPOINT=https://s3.example.com # for MinIO/R2
export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=...
# Redis backend
export SCCACHE_REDIS=redis://user:pass@host:6379/0
sccache --show-statsOptions
| Variable | What it does |
|---|---|
| SCCACHE_BUCKET | S3 bucket name for the cache |
| SCCACHE_ENDPOINT | Custom S3 endpoint (MinIO, R2, on-prem) |
| SCCACHE_REGION | S3 region |
| SCCACHE_S3_KEY_PREFIX | Namespace cache keys within the bucket |
| SCCACHE_REDIS | Redis connection URL backend |
In CI
Use a read-write backend for trusted branches and consider read-only credentials for untrusted PRs so forks cannot poison the shared cache. Namespace with SCCACHE_S3_KEY_PREFIX (or a Redis db index) per toolchain so a compiler bump does not collide with old entries. Confirm the backend with sccache --show-stats, which prints the active store.
Common errors in CI
"Cache errors" in stats with S3 usually means wrong credentials, a missing bucket, or an endpoint that needs path-style addressing (set SCCACHE_ENDPOINT). With Redis, "Connection refused" or auth failures mean a bad SCCACHE_REDIS URL or an unreachable host. A backend that connects but never hits across machines points at a key prefix or compiler_check difference between runners.