Skip to main content
Glama

Curupira

by drzln
lru-cache.ts1.09 kB
/** * Simple LRU Cache implementation */ export class LRUCache<K, V> { private cache: Map<K, V>; private maxSize: number; constructor(maxSize: number) { this.cache = new Map(); this.maxSize = maxSize; } get(key: K): V | undefined { const item = this.cache.get(key); if (item !== undefined) { // Move to end (most recently used) this.cache.delete(key); this.cache.set(key, item); } return item; } set(key: K, value: V): void { // Remove if exists if (this.cache.has(key)) { this.cache.delete(key); } // Add to end this.cache.set(key, value); // Remove oldest if over capacity if (this.cache.size > this.maxSize) { const firstKey = this.cache.keys().next().value; if (firstKey !== undefined) { this.cache.delete(firstKey); } } } has(key: K): boolean { return this.cache.has(key); } delete(key: K): boolean { return this.cache.delete(key); } clear(): void { this.cache.clear(); } get size(): number { return this.cache.size; } }

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/drzln/curupira'

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