import type { RecentProjectsCachePort } from '../../../core/application/ports/RecentProjectsCachePort'; interface CacheEntry { value: T; expiresAt: number; } export class InMemoryRecentProjectsCache implements RecentProjectsCachePort { readonly #entries = new Map>(); async get(key: string): Promise { const entry = this.#entries.get(key); if (!entry) { return null; } if (entry.expiresAt <= Date.now()) { this.#entries.delete(key); return null; } return entry.value; } async set(key: string, value: T, ttlMs: number): Promise { this.#entries.set(key, { value, expiresAt: Date.now() + ttlMs, }); } }