Skip to content

Commit

Permalink
Add save-cache option to README [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
gencer authored Apr 1, 2023
1 parent a52344b commit 0685ca7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Plus, In addition to tarball & rsync, we also do not re-create another tarball f
- [Continue to cache on failed builds](#continue-to-cache-on-failed-builds)
- [Multi-threaded compression](#multi-threaded-compression)
- [Sharing caches between pipelines](#sharing-caches-between-pipelines)
- [Keep the cache file between jobs/builds](#keep-the-cache-file-between-jobsbuilds)
- [Auto deletion old caches](#auto-deletion-old-caches)
- [Globs on paths](#globs-on-paths)
- [Roadmap](#roadmap)
Expand Down Expand Up @@ -493,6 +494,31 @@ steps:
pipeline-slug-override: "other-pipeline" # other-pipeline references the same Gemfile.lock
```
## Keep the cache file between jobs/builds
To prevent re-downloading the same cache again and place it to a temporary directory then copy when necessary use the `save-cache` option as follows:

```yaml
steps:
- name: ':jest: Run tests'
key: jest
command: yarn test --runInBand
plugins:
- nienbo/cache#v2.4.13:
id: ruby # or ruby-3.0
backend: s3
key: "v1-cache-{{ id }}-{{ runner.os }}-{{ checksum 'Gemfile.lock' }}"
restore-keys:
- 'v1-cache-{{ id }}-{{ runner.os }}-'
- 'v1-cache-{{ id }}-'
compress: 2 # fast compression.
s3:
bucket: s3-bucket
save-cache: true # Optional. Saves the cache on temp folder and keep between builds/jobs on the same machine. Defaults to `false`
paths:
- bundle/vendor
```
## Auto deletion old caches
For tarballs, To keep caches and delete them in _for example_ 7 days, use `max: 7`.
Expand Down

0 comments on commit 0685ca7

Please sign in to comment.