Caching Dependencies
Yes, you can - using our caching tools for your dependencies can significantly speed up your jobs.
Saving Cache Example
steps:
- save_cache:
key: my-cache
paths:
- my-file.txt
- my-project/my-dependencies-directory
Restoring Cache Example
steps:
- restore_cache:
keys:
# Find a cache corresponding to this specific package-lock.json checksum
# when this file is changed, this key will fail
- v1-npm-deps-{{ checksum "package-lock.json" }}
# Find the most recently generated cache used from any branch
- v1-npm-deps-
You can see more pertaining to these basic examples here along with other resources related to caching configuration for your project.
You can also view our demo apps to see how caching might be implemented for your project type.
Clearing Cache
Since Caches are immutable, they can not be cleared.
It is helpful to start all your cache keys with a version prefix, for example v1-...
. This allows you to regenerate all of your caches just by incrementing the version in this prefix.
Cache Size
We recommend keeping cache sizes under 500MB. This is our upper limit for corruption checks. Above this limit, check times would be excessively long.
To keep cache sizes down, consider splitting them into multiple distinct caches.
Comments
Article is closed for comments.