Buildless + SCCache

Build caching with SCCache and Buildless

Using SCache with Buildless

SCCache is the spiritual successor to CCache, rewritten in Rust with an emphasis on distributed compile execution as well as caching. It is primarily used with the Rust toolchain, but can be used with nearly any C-like toolchain, like CCache.

Selecting a backend

SCCache supports many backends, including an HTTP-based backend and direct use of Redis.

HTTP ("Webdav") backend

SCCache provides the WebDAV adapter for plain HTTP or HTTP+TLS remote backends; it uses the SCCACHE_WEBDAV_* set of variables, which should be set as demonstrated below:

VariableValue
SCCACHE_WEBDAV_ENDPOINThttps://sccache.less.build/cache/generic
SCCACHE_WEBDAV_USERNAMEapikey (Literal value)
SCCACHE_WEBDAV_PASSWORDYour API key

The HTTP backend is great because it is easy to understand, monitor, and diagnose; in some cases, though, the Redis-based adapter may perform better.

Redis backend

SCCache also supports caching via Redis-compliant backends. Buildless API endpoints natively speak Redis protocol. To configure this backend, you'll use the SCCACHE_REDIS variable, which specifies a formatted connection URL. Here's an example:

VariableValue
SCCACHE_REDISrediss://apikey:{your key}@redis.less.build:6379

Let's break this URL down into components:

ComponentMeaningNotes
rediss://Activate TLSBuildless uses TLS with publicly-verifiable certificates.
apikeyRedis usernameThe literal string apikey, or a specific org tenant ID.
{your key}Redis passwordYour API key should be used in this field.
redis.less.buildEndpointTraffic endpoint.
6379PortBuildless uses the standard Redis port, 6379.

For more information about using Redis with Buildless, see our Buildless + Redis guide.

S3 backend

SCCache can also use S3-compatible APIs as remote storage. Buildless provides support for S3 on a dedicated endpoint. To configure this backend, set the following variable values on your environment:

VariableValueNotes
SCCACHE_ENDPOINThttps://sccache.less.build/cache/s3-
SCCACHE_BUCKET<Your bucket name>The name should be unique within your account.
AWS_ACCESS_KEY_ID<API Key ID>The public ID for your API Key should be used.
AWS_SECRET_ACCESS_KEY<API Key value>The literal API Key value should be used in this field.

See our S3 REST API documentation for a full compatibility guide.