Skip to main content
Glama

MCP Server for Google Cloud Healthcare API

by Kartha-AI
Cache.js1.58 kB
import NodeCache from 'node-cache'; const DEFAULT_CONFIG = { stdTTL: 3600, checkperiod: 120 }; export class CacheManager { cache; version = 'v1'; constructor(config = {}) { this.cache = new NodeCache({ ...DEFAULT_CONFIG, ...config }); } createKey(toolName, params) { const sortedParams = Object.keys(params) .sort() .reduce((acc, key) => { acc[key] = params[key]; return acc; }, {}); return `${this.version}:${toolName}:${JSON.stringify(sortedParams)}`; } async cacheResponse(key, fetchFn) { // Implement caching logic here if needed return await fetchFn(); } async getOrFetch(key, fetchFn, ttl) { try { const cached = this.cache.get(key); if (cached) { return cached; } } catch (error) { console.error('Cache error:', error); } try { const results = await fetchFn(); this.cache.set(key, results, ttl ?? DEFAULT_CONFIG.stdTTL); return results; } catch (error) { const staleData = this.cache.get(key); if (staleData) { return { ...staleData, warning: "Data may be stale due to fetch error" }; } throw error; } } invalidate(key) { this.cache.del(key); } clear() { this.cache.flushAll(); } }

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/Kartha-AI/google-cloud-healthcare-api-mcp'

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