import type { Resource } from "../types/Resource"; export class ResourceCache { private store = new Map>(); set(type: string, id: string, resource: T): void { if (!this.store.has(type)) this.store.set(type, new Map()); this.store.get(type)!.set(id, resource); } get(type: string, id: string): T | undefined { return this.store.get(type)?.get(id) as T | undefined; } getAll(type: string): Map { return (this.store.get(type) as Map) ?? new Map(); } }