mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-29 20:37:05 +02:00
Cache the blobs generated by scripts
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
|
||||
const blobCache: { [hash: string]: string } = {};
|
||||
|
||||
export class BlobCache {
|
||||
static get(hash: string) {
|
||||
return blobCache[hash];
|
||||
}
|
||||
|
||||
static store(hash: string, value: string): void {
|
||||
if (blobCache[hash]) return;
|
||||
blobCache[hash] = value;
|
||||
}
|
||||
|
||||
static removeByValue(value: string) {
|
||||
const keys = Object.keys(blobCache).filter((key) => blobCache[key] === value);
|
||||
keys.forEach((key) => delete blobCache[key]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user