Caching is a great way to optimize performance of job operations by reusing saved data from previous jobs. Setting up a cache within a self-hosted runner is the same process as if you were using CircleCI infrastructure.
To utilize the caching feature on a runner, the data that needs to be cached should be placed in a common directory such as /tmp/.
When restoring the cache, the data will be restored in the same common folder.
- run: echo "sent to job 2" >> /tmp/cache.txt
- run: cat /tmp/cache.txt