Skip to main content
Glama
simple-cache.js1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimpleCache = void 0; class SimpleCache { constructor() { this.cache = new Map(); this.cleanupTimer = null; this.cleanupTimer = setInterval(() => { const now = Date.now(); for (const [key, item] of this.cache.entries()) { if (item.expires < now) this.cache.delete(key); } }, 60000); } get(key) { const item = this.cache.get(key); if (!item || item.expires < Date.now()) { this.cache.delete(key); return null; } return item.data; } set(key, data, ttlSeconds = 300) { this.cache.set(key, { data, expires: Date.now() + (ttlSeconds * 1000) }); } clear() { this.cache.clear(); } destroy() { if (this.cleanupTimer) { clearInterval(this.cleanupTimer); this.cleanupTimer = null; } this.cache.clear(); } } exports.SimpleCache = SimpleCache; //# sourceMappingURL=simple-cache.js.map

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/czlonkowski/n8n-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server