add ability to version caches
This commit is contained in:
parent
cfcc373039
commit
1304a2ec8d
|
@ -45,18 +45,22 @@ export async function getCaches(): Promise<Caches> {
|
|||
if (targetKey) {
|
||||
targetKey = `${targetKey}-`;
|
||||
}
|
||||
|
||||
const registryIndex = `v0-registry-index`;
|
||||
const registryCache = `v0-registry-cache`;
|
||||
const target = `v0-target-${targetKey}${rustKey}`;
|
||||
return {
|
||||
index: {
|
||||
name: "Registry Index",
|
||||
path: paths.index,
|
||||
key: "registry-index-XXX",
|
||||
restoreKeys: ["registry-index"],
|
||||
key: `${registryIndex}-`,
|
||||
restoreKeys: [registryIndex],
|
||||
},
|
||||
cache: {
|
||||
name: "Registry Cache",
|
||||
path: paths.cache,
|
||||
key: `registry-cache-${lockHash}`,
|
||||
restoreKeys: ["registry-cache"],
|
||||
key: `${registryCache}-${lockHash}`,
|
||||
restoreKeys: [registryCache],
|
||||
},
|
||||
git: {
|
||||
name: "Git Dependencies",
|
||||
|
@ -66,8 +70,8 @@ export async function getCaches(): Promise<Caches> {
|
|||
target: {
|
||||
name: "Target",
|
||||
path: paths.target,
|
||||
key: `target-${targetKey}${rustKey}-${lockHash}`,
|
||||
restoreKeys: [`target-${targetKey}${rustKey}`],
|
||||
key: `${target}-${lockHash}`,
|
||||
restoreKeys: [target],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ async function run() {
|
|||
if (registryName) {
|
||||
// save the index based on its revision
|
||||
const indexRef = await getIndexRef(registryName);
|
||||
caches.index.key = `registry-index-${indexRef}`;
|
||||
caches.index.key += indexRef;
|
||||
await io.rmRF(path.join(paths.index, registryName, ".cache"));
|
||||
|
||||
await pruneRegistryCache(registryName, packages);
|
||||
|
|
Loading…
Reference in New Issue