nx/docs/shared/deprecated/legacy-cache.md
Jack Hsu 66eaf2fc74
docs(misc): remove /nx-api pages (#31453)
This PR removes the `/nx-api` pages from `nx-dev`. They are already
redirected from `/nx-api` to either `/technologies` or
`/reference/core-api` URLs.

e.g. `/nx-api/nx` goes to `/reference/core-api/nx` and `/nx-api/react`
goes to `/technologies/react/api`

**Changes**:
- Remove old `nx-api.json` from being generated in
`scripts/documentation/generators/generate-manifests.ts` -- this was
used to generate the sitemap
- Remove `pages/nx-api` from Next.js app since we don't need them
- Remove workaround from link checker
`scripts/documentation/internal-link-checker.ts` -- the angular
rspack/rsbuild and other workarounds are gone now that they are proper
docs in `map.json`
- Update Powerpack/Remote Cache reference docs to exclude API documents
(since they are duplicated in the Intro page) --
`nx-dev/models-document/src/lib/mappings.ts`
- All content in `docs` have been updated with new URL structure

**Note:** Redirects are already handled, and Claude Code was used to
verify the updated `docs/` URLs (see report below). The twelve 404s
links were updated by hand.

## Verification Report

https://gist.github.com/jaysoo/c7863fe7e091cb77929d1976165c357a
2025-06-04 16:57:01 -04:00

2.7 KiB

title description
Legacy Cache Learn about the transition from legacy file system cache to the new database cache in Nx 21, including migration options for custom task runners and shared caches.

Legacy Cache

In Nx 21, the legacy file system cache will be removed in favor of a new database cache. The new database cache stores metadata in a database, rather than blindly trusting the file system. The database cache has the following benefits:

  1. Cache reads and writes are faster.
  2. The local cache is more secure since Nx will no longer retrieve artifacts it does not recognize.

The legacy file system cache can still be used in Nx 20 by setting useLegacyCache: true in your nx.json file. To gain the benefits above, remove useLegacyCache: true from your nx.json.

If you are currently using a custom task runner or the NX_REJECT_UNKNOWN_LOCAL_CACHE environment variable continue reading below.

tasksRunnerOptions

As of Nx 20, the tasksRunnerOptions property in nx.json is deprecated. This property was used to register custom task runners. tasksRunnerOptions and custom task runners will not work with the new database cache.

If you are using a custom tasks runner to customize your cache, you have the following options:

Use Nx Cloud for your remote cache. This is the safest, lowest-maintenance, most recommended option.

If you cannot use Nx Cloud, consider an Nx Powerpack plugin for caching: Amazon S3, Google Cloud, Azure or a shared network drive. If there is no Powerpack plugin that supports the service where you want to store the remote cache, file an issue.

To learn more about migrating from custom task runners, please refer to this detailed guide.

NX_REJECT_UNKNOWN_LOCAL_CACHE

The NX_REJECT_UNKNOWN_LOCAL_CACHE environment variable does not work with the new database cache. We have introduced a new cache which will recognize artifacts from other machines.

If you are using NX_REJECT_UNKNOWN_LOCAL_CACHE to share your local cache on a network drive, you have a few options moving forward:

  1. Use Nx Cloud for your remote cache. This is the safest, lowest-maintenance, most recommended option
  2. Use the Nx Powerpack Shared Fs Cache which recognizes artifacts from other machines
  3. Use another Nx Powerpack plugin for caching on a cloud provider: Amazon S3, Google Cloud, or Azure