mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-09-22 22:00:57 +02:00
19 lines
451 B
TypeScript
19 lines
451 B
TypeScript
|
|
const blobCache: { [hash: string]: string } = {};
|
|
|
|
export class BlobCache {
|
|
static get(hash: string): string {
|
|
return blobCache[hash];
|
|
}
|
|
|
|
static store(hash: string, value: string): void {
|
|
if (blobCache[hash]) return;
|
|
blobCache[hash] = value;
|
|
}
|
|
|
|
static removeByValue(value: string): void {
|
|
const keys = Object.keys(blobCache).filter((key) => blobCache[key] === value);
|
|
keys.forEach((key) => delete blobCache[key]);
|
|
}
|
|
}
|