import { MAX_PATCH_CACHE } from "../constants.ts"; export type ApplyResult = { status: "clean" | "conflict"; output: string }; const cache = new Map(); export const patchCache = { get: (id: number): ApplyResult | undefined => cache.get(id), set: (id: number, result: ApplyResult) => { if (cache.size >= MAX_PATCH_CACHE) { cache.delete(cache.keys().next().value!); } cache.set(id, result); }, invalidate: (id: number) => cache.delete(id), };