sccache integration

sccache is a compiler caching tool that supports C, C++, Rust, and other languages.

Namespace provides high-performance sccache caching with very low network latency between runners and the cache storage. This allows your builds to reuse compilation results across runs, significantly reducing build times.

sccache caching is particularly effective for:

  • C and C++ projects with long compilation times
  • Rust projects where incremental compilation can be slow
  • Projects that benefit from sharing compilation artifacts across team members

Getting started

You can produce a ready-to-use configuration using the CLI:

Configure cache access

$
nsc cache sccache setup --cache_name default

This command generates short-term credentials and prints the environment variables needed to configure sccache (e.g. SCCACHE_WEBDAV_ENDPOINT, SCCACHE_WEBDAV_TOKEN).

Use the sccache cache

Export the printed environment variables, then start sccache:

$ sccache --start-server

sccache will now use Namespace's remote cache for all subsequent compilations.

GitHub Actions Example

jobs:
build:
runs-on: namespace-profile-default
steps:
- uses: actions/checkout@v4
- name: Setup sccache
run: |
export $(nsc cache sccache setup --cache_name default)
- name: Build
run: cargo build

Using from your local workstation

You can also use the same sccache cache locally from your workstation. Since the cache is shared, local builds benefit from artifacts already cached by CI — and vice versa.

First, create a long-term token with access to the cache:

$ nsc cache sccache create-token --cache_name default
Token ID:    tok_...
Name:        sccache-default-n525mfg
Expires At:  2026-02-13T12:07:43+01:00
 
You can set up your sccache config with:
  nsc cache sccache setup --token token.json --cache_name default

This saves the token to token.json in the current directory. Then configure sccache using the token:

$ nsc cache sccache setup --token token.json --cache_name default

This prints the environment variables needed to configure sccache with credentials bound to your user. Export them to your shell. If the current user gets removed from the workspace (or their permissions are reduced), the token becomes invalid. The token can also be revoked ahead of time.

How it works

The sccache caching solution provides remote storage for compilation artifacts, where the hot cache lives as close to the consumer (e.g. your CI job runner) as possible. The cold caching tier is backed by our high-performance artifact storage and enables sccache to retain a vast amount of cached artifacts.

Access to the sccache cache is granted through short-lived secure credentials.

Usage

Namespace accounts sccache cache usage in two categories:

  • Artifact cache storage
  • Artifact cache reads

For detailed billing information for each item as well as included amounts in your plans, visit the pricing page.

Last updated