✨ feat(cache): add in-memory cache service (ADR-0022 Phase 1 part 2) #23
Reference in New Issue
Block a user
Delete Branch "feat/cache-service-inmemory"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements Phase 1 part 2 of ADR-0022: in-memory cache service via
github.com/patrickmn/go-cache. Companion to PR #22 (rate limit middleware). Together they complete Phase 1 of the rate-limit + cache strategy.Spec
cache.Service):Set / Get / Delete / Flush / ItemCountInMemoryServicebacked by go-cache (TTL + automatic cleanup)cache.*(Enabled, DefaultTTLSeconds=300, CleanupIntervalSeconds=600)handleVersionnow memoizes the response for 60 seconds (cache key per format)Out of scope
Changes
pkg/cache/cache.go(NEW, 58 lines): Service interface + InMemoryServicepkg/cache/cache_test.go(NEW, 125 lines, 6/6 unit tests PASS)pkg/config/config.go: CacheConfig + defaults + env binds + getters (mirrors RateLimitConfig pattern)pkg/server/server.go:cacheServicefield on Server, init in NewServer, use in handleVersionconfig.yaml: cache section with defaultsgithub.com/patrickmn/go-cache v2.1.0+incompatibleTest plan
go build ./pkg/cache/...PASSgo build ./pkg/config/...PASSgo build ./pkg/server/...PASSgo test ./pkg/cache/...6/6 PASSgo test ./pkg/config/...PASSgo test ./pkg/server/...PASSgo test ./features/health/...PASS (no regression)Migration context
ARCODANGE Phase 1 — autonomous run via Mistral Vibe with ICM workspace at
~/Work/Vibe/workspaces/cache-service-inmemory/.Optimization win: T6 stages 01-02 cost €2.50 (vs €5+ for similar T5 rate-limit) thanks to pre-extracted snippets in
shared/. Documented in~/.vibe/skills/prompt-builder/examples/add-feature.md.🤖 Co-Authored-By: Mistral Vibe (devstral-2 / mistral-medium-3.5) + Claude Opus 4.7