Closed rbtcollins closed 1 year ago
I don't really understand what you are trying to achieve. Could you please provide an example and the expected outcome. Do you want to filter the files?
Yes.
In ~/.cargo/bin there are two distinct sets of files.
1) hardlinks provided by rustup proxies: rustc
, cargo
and the like. These are immutable and should not be cached.
2) binaries installed by cargo install
such as cargo-audit
. These should be cached, because building takes time and cargo will detect freshness automatically (if we cache all of `~/.cargo/ to get the freshness metadata files).
Right now I mv
the files in set (1) out of the way right before the cache is saved, then restore them afterwards. It would be nicer to be able to just not save them in the cache.
Right now I mv the files in set (1) out of the way right before the cache is saved, then restore them afterwards. It would be nicer to be able to just not save them in the cache.
Makes sense. An exclude filter would solve the issue, right?
Yes, An exclude filter would work (as long as its a list of rules, not a single rule); or a closure to evaluate each file, or whatever.
This would be a breaking change but I guess it makes sense. Is #33 working for you?
Currently I'm passing in a helper closure with a try/finally - not strictly needed since the cache isn't saved on failure, but anyhow - here's the scenario. Consider https://github.com/marketplace/actions/rust-cache - note that it cleans the cache dir of:
Possibly having these layered closures is the right way to do it, but I was pondering whether some hook-style interface might permit simpler code.