computeBuildCacheKey
computeBuildCacheKey(
parentLayerId,command):Promise<string>
Defined in: packages/core/src/kernel/layer.ts:162
Compute the build cache key for a .run() step.
Parameters
Section titled “Parameters”parentLayerId
Section titled “parentLayerId”string | undefined
Id of the layer the step will run on top of, or undefined for base.
command
Section titled “command”string
The shell command of the .run() step.
Returns
Section titled “Returns”Promise<string>
A hex SHA-256 string suitable for BuildCache.get.
Remarks
Section titled “Remarks”Key is sha256(parentLayerId + '|' + command). An undefined parent is
hashed as the empty string, so base-layer steps still produce a stable
key. Used by the builder to decide whether an upcoming .run() can be
skipped by replaying the previously cached result layer.
Example
Section titled “Example”import { computeBuildCacheKey, createBuildCache } from '@fishnet/core'
const cache = createBuildCache()const key = await computeBuildCacheKey('abc123', 'apk add curl')const cachedLayerId = cache.get(key)