> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# nsc cache gradle setup

Set up a remote Gradle build cache.

Namespace provides high-performance Gradle build caching with very low network latency between runners and the cache storage.
This allows your Gradle workflows to reuse build outputs across runs, significantly reducing build times.
`cache gradle setup` sets up a remote Gradle build cache and generates an init script to use it.

[Learn more about Gradle caching →](/docs/integrations/gradle)

## Usage

```bash theme={null}
nsc cache gradle setup [--cache_name <name>] \
  [--init-gradle <path>] \
  [--output <plain|json>] \
  [--push] \
  [--site <site>] \
  [--token <path>] \
  [--user]
```

### Example

The following example creates a remote Gradle build cache and uses it during a build invocation.

<Steps titleSize="h4">
  <Step title="Configure the remote cache">
    Generate a Gradle init script for the remote cache:

    ```bash theme={null}
    nsc cache gradle setup --init-gradle=/tmp/init.gradle
    ```
  </Step>

  <Step title="Run a build">
    Use the generated init script during a build:

    ```bash theme={null}
    gradle --init-script=/tmp/init.gradle build
    ```
  </Step>
</Steps>

## Options

<h3 id="--cache_name">
  \--cache\_name
</h3>

A name for the cache. Defaults to `default`.

<h3 id="--init-gradle">
  \--init-gradle
</h3>

If specified, write the init script to this path.

<h3 id="-o---output">
  -o, --output
</h3>

Output format, one of `plain` or `json`. Defaults to `plain`.

<h3 id="--push">
  \--push
</h3>

Whether to enable pushing to the cache. Defaults to `true`.

<h3 id="--site">
  \--site
</h3>

Site preference (e.g. `iad`, `fra`). If not set, determined automatically.

<h3 id="--token">
  \--token
</h3>

Path to a token file for long-term access (e.g. from local workstations). If not specified, short-term credentials are generated.

<h3 id="--user">
  \--user
</h3>

If specified, write the configuration to the Gradle user home directory.
