import type { CacheService } from "./cache-service"; export class MemoryCacheService implements CacheService { private cache = new Map(); async get(key: string): Promise { const item = this.cache.get(key); if (!item) return null; if (item.expiry && item.expiry < Date.now()) { this.cache.delete(key); return null; } return item.value as T; } async set(key: string, value: T, ttlSeconds?: number): Promise { const expiry = ttlSeconds ? Date.now() + ttlSeconds * 1000 : null; this.cache.set(key, { value, expiry }); } async delete(key: string): Promise { this.cache.delete(key); } }