const { logToFile } = require('./logger'); class MemoryCache { constructor() { this.store = new Map(); } get(key) { const entry = this.store.get(key); if (!entry) return null; if (Date.now() > entry.expiresAt) { this.store.delete(key); return null; } return entry.value; } set(key, value, ttlMs) { this.store.set(key, { value, expiresAt: Date.now() + ttlMs }); } invalidate(key) { this.store.delete(key); } clear() { this.store.clear(); } } const cache = new MemoryCache(); module.exports = cache;