-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(core): update legacy cache documentation
- Loading branch information
1 parent
d0de31a
commit 2e3726c
Showing
1 changed file
with
13 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
# Legacy Cache | ||
|
||
In Nx 20, the local cache metadata are stored in a database, rather than using the file system. (Cache artifacts are still stored on the file system.) In Nx 21 the legacy file system cache will be removed and the database cache will be the only option. The database cache has two benefits: | ||
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 other processes with access to the file system can no longer read or modify the cache. | ||
2. The local cache is more secure since Nx will no longer retrieve artifacts it does not recognize. | ||
|
||
For most organizations, this feature is a net positive. If you are currently using a custom task runner or the `NX_REJECT_UNKNOWN_LOCAL_CACHE` environment variable, you are most likely providing your own custom [remote cache](/ci/features/remote-cache) storage location. | ||
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 only work with the legacy file system cache. | ||
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 `tasksRunnerOptions`, you have a few options moving forward: | ||
|
||
1. Use [Nx Cloud](/nx-cloud) for your remote cache | ||
2. Use an [Nx Powerpack](/powerpack) plugin to store your remote cache on [Amazon S3](/nx-api/powerpack-s3-cache), [Google Cloud](/nx-api/powerpack-gcs-cache), [Azure](/nx-api/powerpack-azure-cache) or a [network drive](/nx-api/powerpack-shared-fs-cache) | ||
3. If there is no Powerpack plugin that supports the service where you want to store the remote cache, [file an issue](https://github.com/nrwl/nx/issues/new) requesting that we create one. | ||
4. Use the legacy file system cache until Nx 21 by setting `useLegacyCache: true` in your `nx.json` file | ||
1. Use [Nx Cloud](/nx-cloud) for your remote cache. This is the safest, lowest-maintenance, most recommended option | ||
2. If you cannot use Nx Cloud, consider an [Nx Powerpack](/powerpack) plugin for caching: [Amazon S3](/nx-api/powerpack-s3-cache), [Google Cloud](/nx-api/powerpack-gcs-cache), [Azure](/nx-api/powerpack-azure-cache) or a [shared network drive](/nx-api/powerpack-shared-fs-cache) | ||
3. If there is no Powerpack plugin that supports the service where you want to store the remote cache, [file an issue](https://github.com/nrwl/nx/issues/new) | ||
|
||
## NX_REJECT_UNKNOWN_LOCAL_CACHE | ||
|
||
The `NX_REJECT_UNKNOWN_LOCAL_CACHE` environment variable only works with the legacy file system 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](/nx-cloud) for your remote cache | ||
2. Use an [Nx Powerpack](/powerpack) plugin to store your remote cache on a [network drive](/nx-api/powerpack-shared-fs-cache) | ||
3. Use the legacy file system cache until Nx 21 by setting `useLegacyCache: true` in your `nx.json` file | ||
1. Use [Nx Cloud](/nx-cloud) for your remote cache. This is the safest, lowest-maintenance, most recommended option | ||
2. Use the [Nx Powerpack Shared Fs Cache](/nx-api/powerpack-shared-fs-cache) which recognizes artifacts from other machines | ||
3. Use another [Nx Powerpack](/powerpack) plugin for caching on a cloud provider: [Amazon S3](/nx-api/powerpack-s3-cache), [Google Cloud](/nx-api/powerpack-gcs-cache), or [Azure](/nx-api/powerpack-azure-cache) |