

# Buildkite CLI cache command

The `bk cache` command allows you to manage Buildkite cache resources from the command line.

## Commands

| Command | Description |
| --- | --- |
| `bk cache registry list` | List cluster cache registries. |
| `bk cache registry view` | View a cluster cache registry. |
| `bk cache registry create` | Create a new cluster cache registry. |
| `bk cache registry update` | Update a cluster cache registry. |
| `bk cache registry delete` | Delete a cluster cache registry. |

## List cache registries

List cluster cache registries.

```bash
bk cache registry list <cluster-uuid> [flags]
```

### Arguments

| Argument | Description |
| --- | --- |
| `<cluster-uuid>` | Cluster UUID to list cache registries for |

### Flags

| Flag | Description |
| --- | --- |
| `-o`, `--output=""` | Output format. One of: json, yaml, text |
| `--debug` | Enable debug output for REST API calls |
| `--json` | Output as JSON |
| `--limit=100` | Maximum number of cache registries to return |
| `--per-page=30` | Number of cache registries per page |
| `--text` | Output as text |
| `--yaml` | Output as YAML |

### Examples

```bash
bk cache registry list my-cluster-uuid
```

```bash
bk cache registry list my-cluster-uuid --limit 200
```

```bash
bk cache registry list my-cluster-uuid --output json
```

## View a cache registry

View a cluster cache registry.

```bash
bk cache registry view <cluster-uuid> <registry-uuid> [flags]
```

### Arguments

| Argument | Description |
| --- | --- |
| `<cluster-uuid>` | Cluster UUID the cache registry belongs to |
| `<registry-uuid>` | Cache registry UUID to view |

### Flags

| Flag | Description |
| --- | --- |
| `-o`, `--output=""` | Output format. One of: json, yaml, text |
| `--debug` | Enable debug output for REST API calls |
| `--json` | Output as JSON |
| `--text` | Output as text |
| `--yaml` | Output as YAML |

## Create a cache registry

Create a new cluster cache registry.

```bash
bk cache registry create --name=STRING <cluster-uuid> [flags]
```

### Arguments

| Argument | Description |
| --- | --- |
| `<cluster-uuid>` | Cluster UUID to create the cache registry in |

### Flags

| Flag | Description |
| --- | --- |
| `-o`, `--output=""` | Output format. One of: json, yaml, text |
| `--color=COLOR` | Color for the cache registry |
| `--debug` | Enable debug output for REST API calls |
| `--description=DESCRIPTION` | Description for the cache registry |
| `--emoji=EMOJI` | Emoji for the cache registry |
| `--json` | Output as JSON |
| `--name=STRING` | Name for the cache registry |
| `--policy-file=STRING` | Read the policy from a YAML or JSON file, or from stdin with `-` |
| `--text` | Output as text |
| `--yaml` | Output as YAML |

### Examples

Create with the default unrestricted policy (trusted builds only):

```bash
bk cache registry create my-cluster-uuid --name "Ruby gems"
```

Create with an explicit policy:

```bash
bk cache registry create my-cluster-uuid --name "Ruby gems" --policy-file policy.yml
```

```bash
cat policy.json | bk cache registry create my-cluster-uuid --name "Ruby gems" --policy-file -
```

## Update a cache registry

Update a cluster cache registry.

```bash
bk cache registry update <cluster-uuid> <registry-uuid> [flags]
```

### Arguments

| Argument | Description |
| --- | --- |
| `<cluster-uuid>` | Cluster UUID the cache registry belongs to |
| `<registry-uuid>` | Cache registry UUID to update |

### Flags

| Flag | Description |
| --- | --- |
| `-o`, `--output=""` | Output format. One of: json, yaml, text |
| `--clear-color` | Clear the cache registry color |
| `--clear-description` | Clear the cache registry description |
| `--clear-emoji` | Clear the cache registry emoji |
| `--clear-policy` | Clear the policy, denying all cache saves and restores |
| `--color=COLOR` | New color for the cache registry |
| `--debug` | Enable debug output for REST API calls |
| `--description=DESCRIPTION` | New description for the cache registry |
| `--emoji=EMOJI` | New emoji for the cache registry |
| `--json` | Output as JSON |
| `--name=NAME` | New name for the cache registry (regenerates its slug) |
| `--policy-file=STRING` | Read the new policy from a YAML or JSON file, or from stdin with `-` |
| `--text` | Output as text |
| `--yaml` | Output as YAML |

### Examples

```bash
bk cache registry update my-cluster-uuid my-registry-uuid --name "Ruby gems"
```

```bash
bk cache registry update my-cluster-uuid my-registry-uuid --policy-file policy.yml
```

```bash
bk cache registry update my-cluster-uuid my-registry-uuid --clear-description
```

## Delete a cache registry

Delete a cluster cache registry.

```bash
bk cache registry delete <cluster-uuid> <registry-uuid>
```

### Arguments

| Argument | Description |
| --- | --- |
| `<cluster-uuid>` | Cluster UUID the cache registry belongs to |
| `<registry-uuid>` | Cache registry UUID to delete |

### Flags

| Flag | Description |
| --- | --- |
| `--debug` | Enable debug output for REST API calls |

### Examples

```bash
bk cache registry delete my-cluster-uuid my-registry-uuid
```

```bash
bk cache registry delete my-cluster-uuid my-registry-uuid --yes
```
