Skip to main content
Glama
task-cache.ts957 B
import { getTaskById } from '../tasks/task-retrieval'; // In-memory cache for task names const taskNameCache = new Map<string, string>(); /** * Store a task name in the cache */ export function setTaskName(taskId: string, taskName: string): void { taskNameCache.set(taskId, taskName); } /** * Get a task name from cache or fetch from API if not cached */ export async function getTaskName(taskId: string): Promise<string> { // Check if task name is in cache if (taskNameCache.has(taskId)) { return taskNameCache.get(taskId)!; } // Fetch task from API if not in cache try { const task = await getTaskById(taskId); const taskName = task.content; // Cache the task name for future requests taskNameCache.set(taskId, taskName); return taskName; } catch (error) { throw error; } } /** * Clear all cached task names (for testing purposes) */ export function clearCache(): void { taskNameCache.clear(); }

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/bkotos/todoist-mcp'

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