UNPKG

@diullei/codeguardian

Version:

Open-source developer tool to validate and enforce architectural rules, especially for AI-generated code

25 lines 616 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResultCache = void 0; class ResultCache { cache = new Map(); async get(key, factory) { if (this.cache.has(key)) { return this.cache.get(key); } const result = await factory(); this.cache.set(key, result); return result; } has(key) { return this.cache.has(key); } set(key, value) { this.cache.set(key, value); } clear() { this.cache.clear(); } } exports.ResultCache = ResultCache; //# sourceMappingURL=ResultCache.js.map