BuidlZone-Labs/zicket-web
Unbounded In-Memory Cache Class Lacks Eviction & Serverless Persistence
Offen
#177 geöffnet am 29.07.2026
Stellar Wavedifficulty: mediumenhancementhelp wantedperformance
Repository-Metriken
- Stars
- (4 Sterne)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
Category
Performance
Priority
Medium
Description
lib/cache.ts provides InMemoryCache using a static JS Map. In long-running node processes, key entries accumulate indefinitely without an LRU maximum capacity cap. In serverless deployment environments (Vercel Edge/Lambdas), static Map state is lost between cold starts and isolated per instance.
Evidence from lib/cache.ts#L18-L20:
class InMemoryCache {
private static store = new Map<string, CacheEntry<unknown>>();
}
Proposed Solution
- Add an upper bound on key size and implement LRU (Least Recently Used) cache eviction.
- For production deployments, integrate Redis / Upstash or Next.js
unstable_cache/fetchcache.
Acceptance Criteria
- Cache map respects a configurable max capacity (e.g. 500 items).
- Expired or old items are evicted automatically.
- No unbounded memory growth.
Files
lib/cache.tslib/dataFetching.ts