kache 0.28.0

Zero-copy, content-addressed build cache for Rust, C/C++ and more, with S3 and shared-filesystem remotes.
---
title: Sync
description: Pull and push cache entries without the daemon
---

`kache sync` talks directly to the configured remote. It is useful for explicit CI warm and publish steps. It lists the remote to compare it with the local store, so on S3 its credentials need `s3:ListBucket`.

```bash
kache sync                 # pull, then push
kache sync --pull          # download only
kache sync --push          # upload only
kache sync --dry-run       # show the plan
kache sync --all           # ignore pull filtering
kache sync --workspace     # pull discovery for workspace members only
kache sync --allow-partial # report failures but exit successfully
```

## Filtering

Pull and push use different scopes:

- Pull normally lists crates from `Cargo.lock` in the current directory. With no usable lockfile it falls back to listing the full remote.
- `--workspace` lists only Cargo workspace members and fails if it cannot resolve the workspace. It conflicts with `--all`.
- Inside a Cargo workspace, push uploads only workspace members, from `cargo metadata --no-deps`. With no `Cargo.toml` in the directory and no `--manifest-path`, it uploads every local entry. Build-script runs are never pushed.
- `--manifest-path` selects the workspace for push and for `--workspace` pulls.

Narrowing the initial pull does not disable on-demand dependency restores during a later daemon-backed build.

## CI sequence

```bash
kache sync --pull
cargo build --release
kache daemon stop
```

The daemon uploads new entries in the background, dependencies included. `kache daemon stop` lets it finish its queued uploads before it exits. Inside a Cargo workspace, `kache sync --push` uploads only that workspace's own crates. Use it when you run without the daemon and those crates are what you want to publish.

## Failure behavior

All scheduled operations drain before the command exits. Any transfer or import failure makes the command nonzero unless `--allow-partial` is set.

`cache.s3_concurrency` / `KACHE_S3_CONCURRENCY` (default 16) controls parallel operations for both S3 and filesystem remotes.

Use `--dry-run` to inspect the planned crate names and truncated keys. Object sizes are not available from the listing plan.