cache key
The name a cache entry is saved and looked up under, usually built from the operating system and a hash of the lock file.
In more detail
Because an entry is never overwritten, the key must change exactly when the dependencies change. A key without a content hash is filled once and then restores stale dependencies forever.
Example
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.lock') }}Related terms
- dependency cache — Saved copies of downloaded dependencies that GitHub Actions restores into later runs so they need not be fetched again.
- hashFiles — A workflow expression function that returns one SHA-256 hash for the files matching a pattern.
- lock file — A file listing the exact version of every dependency, so installs are repeatable.
- restore-keys — A list of key prefixes the cache action tries, in order, when no entry matches the exact key.
- cache — A store of earlier answers kept close to where they are needed so they can be reused instead of fetched or computed again.
- cache invalidation — Marking cached copies as out of date, or deleting them, when the real data changes so the next read fetches fresh data.
- TanStack Query — A library that fetches, caches and refreshes server data in frontend apps, and runs changes to it as mutations.
Taught in
- Speeding Up Builds: Caching Dependencies — Continuous Integration & Continuous Delivery Pipelines
- Composite And Docker Actions: Troubleshooting And Immutable Releases — GitHub Actions (GH-200) Exam Prep
- Client-Side Data Fetching Architectures with Suspense — React 19 & Modern Component Architecture