Say I want to maintain cache volumes for different pipeline steps and branches, so I use <BRANCH> and <PIPELINE-STEP> as part of the cache key (i.e. java-ci_build-step_main). I would like feature branches to use the same cache as the default branch (main) for its base to speedup the initial build on a PR, but not actually reuse them as I want cache isolation. GHA cache has kind of a similar property: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache.
Basically, I'm looking for another argument base_cache for the Container.with_mounted_cache method i.e. if you don't find the requested cache then duplicate the cache found in base_cache and use that as your base (but without altering the original). If not even base_cache exists, then just proceed with creating the cache entry as you would now.
Is there an easier way to achieve what I want? Staying within Dagger would be the most convenient.
If it's not possible, would this make sense as a feature request? I can open an issue.