Is there any way to interact more directly with th...
# plugins
g
Is there any way to interact more directly with the cache from a plugin? Ignoring named caches for now. Right now as I understand it, the cache is Request -> Digest. Let's say I want to cache a file. The file is one of many outputs from a rule. I want to be able to recall one or more of those files later, but not all. The recalling rule might be completely unrelated to the original generator. We can assume files uniquely a specific set of data, so no collisions/mismatch. (This might be one of those Stackoverflowy X-Y problems)
To be less roundabout; the issue I'm trying to solve is that I want to cache each library built as part of a Cargo command independently, so e.g. if
//target1
built tokio
//src/rust:foobar
can use that prebuilt, without using the whole output from //target1. So at the end of
target1
I'd want to
for artifact in target_dir: set_cache(my-unique-key, DigestSubset(...))
and then recall that with
get_cache(my-unique-key)
anywhere else to read it.
I have already solved a bunch of caching variants with named caches, but they seem to be fraught with peril and I've understood they don't interact very well with remote caches.