3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-07-31 10:23:19 +00:00

disambiguate incremental caches

This commit is contained in:
Jonathan Kelley 2025-01-28 20:24:43 -08:00
parent 2de18fd6ad
commit 8c044fe7cc
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
3 changed files with 27 additions and 3 deletions

View file

@ -23,7 +23,11 @@ export class CacheConfig {
public cachePaths: Array<string> = [];
/** The primary cache key */
public cacheKey = "";
/** The secondary (restore) key that only contains the prefix and environment */
/**
* The secondary (restore) key that only contains the prefix and environment
* This should be used if the primary cacheKey is not available - IE pulling from main on a branch
* instead of the branch itself
* */
public restoreKey = "";
/** Whether to cache CARGO_HOME/.bin */
@ -251,6 +255,8 @@ export class CacheConfig {
keyFiles.push(...parsedKeyFiles);
self.keyFiles = sort_and_uniq(keyFiles);
// todo(jon): make sure we differentiate incrementals on different branches
// we can use just a single cache per incremental branch
if (self.incremental) {
key += `-incremental`;
}