Rush StackShopBlogEvents
Skip to main content

Home > @microsoft/rush-lib > BuildCacheConfiguration

BuildCacheConfiguration class

This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Use this class to load and save the "common/config/rush/build-cache.json" config file. This file provides configuration options for cached project build output.

Signature:

export declare class BuildCacheConfiguration 

Properties

Property

Modifiers

Type

Description

buildCacheEnabled

readonly

boolean

(BETA) Indicates whether the build cache feature is enabled. Typically it is enabled in the build-cache.json config file.

cacheHashSalt

readonly

string | undefined

(BETA) An optional salt to inject during calculation of the cache key. This can be used to invalidate the cache for all projects when the salt changes.

cacheWriteEnabled

boolean

(BETA) Indicates whether or not writing to the cache is enabled.

cloudCacheProvider

readonly

ICloudBuildCacheProvider | undefined

(BETA) The provider for interacting with the cloud build cache, if configured.

getCacheEntryId

readonly

GetCacheEntryIdFunction

(BETA) Method to calculate the cache entry id for a project, phase, and project state.

localCacheProvider

readonly

FileSystemBuildCacheProvider

(BETA) The provider for interacting with the local build cache.

Methods

Method

Modifiers

Description

getBuildCacheConfigFilePath(rushConfiguration)

static

(BETA) Gets the absolute path to the build-cache.json file in the specified rush workspace.

loadAndRequireEnabledAsync(terminal, rushConfiguration, rushSession)

static

(BETA) Loads the build-cache.json data from the standard file path common/config/rush/build-cache.json. If the file has not been created yet, or if the feature is not enabled, then an error is reported.

tryLoadAsync(terminal, rushConfiguration, rushSession)

static

(BETA) Attempts to load the build-cache.json data from the standard file path common/config/rush/build-cache.json. If the file has not been created yet, then undefined is returned.