Docker and CI/CD · Middle · Question 32 of 75
What makes a good cache key for node_modules or the npm cache in CI?
- ✓Correct answer: The OS plus a hash of the lockfile
- 2The commit SHA, unique for every run
- 3The current date, so it refreshes daily
Explanation
hashFiles('**/package-lock.json') changes only when dependencies change. A commit SHA would never hit; restore-keys can fall back to a partial match.