Remove dependents from cache when dependency updated

This commit is contained in:
theit8514
2022-01-09 03:50:36 -05:00
parent 8b69fd7faa
commit 423efe19e1
4 changed files with 54 additions and 16 deletions
+6 -2
View File
@@ -3,12 +3,16 @@ import { ScriptUrl } from "../Script/ScriptUrl";
const importCache: { [hash: string]: ScriptUrl[] } = {};
export class ImportCache {
static get(hash: string): ScriptUrl[] {
return importCache[hash];
static get(hash: string): ScriptUrl[] | null {
return importCache[hash] || null;
}
static store(hash: string, value: ScriptUrl[]): void {
if (importCache[hash]) return;
importCache[hash] = value;
}
static remove(hash: string): void {
delete importCache[hash];
}
}