UNPKG

@nomyx/assistant

Version:

A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)

32 lines (31 loc) 832 B
"use strict"; // LOCKED: TRUE // All content in this file is locked and cannot be edited. Object.defineProperty(exports, "__esModule", { value: true }); exports.MemoryCacheManager = void 0; class MemoryCacheManager { constructor() { this.cache = new Map(); } async get(key) { const entry = this.cache.get(key); if (!entry) return null; if (Date.now() > entry.expiry) { this.cache.delete(key); return null; } return entry.value; } async set(key, value, ttl) { const expiry = Date.now() + ttl * 1000; this.cache.set(key, { value, expiry }); } async delete(key) { this.cache.delete(key); } async clear() { this.cache.clear(); } } exports.MemoryCacheManager = MemoryCacheManager;