Hi, I want to be able to cache some downloads and dependencies we use during our build, how does the save-cache, restore-cache work. If I restore the cache do in the next step that would install the download/apt-get package check if the folder exists, then skip the step?
It won’t work for apt packages. For those, you should install them on your Docker image.
For Ruby/Node/etc. dependencies, yes, caching the directory and restoring it will prevent the next step from redownloading everything.
ok so everything in the restore_cache —> save_cache is ignored if it finds a cache?
If the key is already available it will not overwrite it.
Hey Rohara, so If the key is already available it will not overwrite it, then what if I add some gems to the Gemfile, then do I need to update the name of cache key as well so that it will create new cache including newer gems? If yes then it would involve additional task of update cache key in circleci v2 for every gem update which doesn’t seem good
You can use a
checksum device on your package manager’s install file, which should change as soon as your dependencies are modified. See here: