What is a pipeline cache and why should you use it?
Answer
A pipeline cache stores files between pipeline runs to avoid re-downloading or recomputing them on every run. The most common use case is caching package manager dependencies — node_modules/ for npm, .m2/ for Maven, vendor directory for Composer — so the pipeline doesn't re-download hundreds of packages every run. GitHub Actions provides a actions/cache action that stores and restores a directory based on a cache key (typically a hash of the lockfile). A cache hit can reduce a 3-minute dependency installation to a 10-second restore. Without caching, large pipelines waste significant time and egress bandwidth on repeated downloads. Docker layer caching (--cache-from) similarly avoids re-building unchanged image layers, dramatically speeding up container builds.
Previous
What is a build matrix in CI and when is it useful?
Next
What is a container registry and which ones are commonly used?