Distributed Caching

Only < build | test | lint | … > Once

When running Nx without Nx Cloud, a computation cache is created on your local machine to make the developer experience faster. This allows you to not waste time re-building, re-testing, re-linting, or any number of other actions you might take on code that hasn’t changed. Unfortunately, since the cache is stored locally, you are the only member of your team that can take advantage of these instant commands.

Nx Cloud allows this cache to be shared across your entire organization, meaning that any cacheable operation completed on your workspace only needs to be run once.

The time savings that this can provide your team are drastic. This blog post explains how such a simple concept can have a massive impact on productive time for you and your team.

Enabling Cache

To make sure the cache is on:

  1. Connect your workspace to Nx Cloud

  2. Make sure the cacheableOperations array in nx.json contains all the targets you want to cache.

  3. Make sure you configure an Nx Cloud access token.

If you configure a read-write access token in nx.json or via the NX_CLOUD_ACCESS_TOKEN env variable, any time you run a command the Nx CLI will upload the artifacts to the cloud.

If you configure the read-only access token, the Nx CLI will try to download cached artifacts from the Nx Cloud, but won't try to store them.

See the Configuring the Cloud Runner section for more information on how to configure and troubleshoot the cache.

Select an article to learn more about Nx Cloud