3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-04-11 07:03:37 +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

11
dist/restore/index.js vendored
View file

@ -86767,7 +86767,11 @@ class CacheConfig {
this.cachePaths = [];
/** The primary cache key */
this.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
* */
this.restoreKey = "";
/** Whether to cache CARGO_HOME/.bin */
this.cacheBin = true;
@ -86946,6 +86950,11 @@ class CacheConfig {
let lockHash = digest(hasher);
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`;
}
key += `-${lockHash}`;
self.cacheKey = key;
self.cachePaths = [external_path_default().join(config_CARGO_HOME, "registry"), external_path_default().join(config_CARGO_HOME, "git")];

11
dist/save/index.js vendored
View file

@ -86767,7 +86767,11 @@ class CacheConfig {
this.cachePaths = [];
/** The primary cache key */
this.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
* */
this.restoreKey = "";
/** Whether to cache CARGO_HOME/.bin */
this.cacheBin = true;
@ -86946,6 +86950,11 @@ class CacheConfig {
let lockHash = digest(hasher);
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`;
}
key += `-${lockHash}`;
self.cacheKey = key;
self.cachePaths = [external_path_default().join(CARGO_HOME, "registry"), external_path_default().join(CARGO_HOME, "git")];

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`;
}