refactor(auth): replace in-memory auth cache with Redis#2289
Conversation
…ross-instance invalidation Both the API and dashboard-API now use a shared Redis-backed auth cache (prefix "auth:team") instead of per-process in-memory caches. This ensures cache invalidation is consistent across all service instances. - Replace MemoryCache with RedisCache in AuthCache - NewAuthCache now requires a redis.UniversalClient parameter - Add Redis config vars to dashboard-api (cfg, Nomad job, Terraform module) - Wire existing redisClient through to auth cache in API's store.go Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR SummaryMedium Risk Overview Written by Cursor Bugbot for commit 709f813. This will update automatically on new commits. Configure here. |
…i-cache-invalidation-to-use-redis # Conflicts: # packages/auth/pkg/auth/cache.go
Add post-parse validation that at least one of REDIS_URL or REDIS_CLUSTER_URL is set, surfacing a clear error instead of the misleading "redis is disabled" fatal from the factory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
MemoryCacheinAuthCachewithRedisCacheso auth cache invalidation is correct across all service instancesauth:team) with 5m TTL and 1m background refreshChanges
packages/auth/pkg/auth/cache.go—NewAuthCachenow takes aredis.UniversalClient; usesRedisCachedirectlypackages/api/internal/handlers/store.go— passes existingredisClienttoNewAuthCachepackages/dashboard-api/main.go— creates Redis client viafactories.NewRedisClientpackages/dashboard-api/internal/cfg/model.go— addsRedisURL,RedisClusterURL,RedisTLSCABase64iac/modules/job-dashboard-api/— adds Redis variables and env vars to Nomad jobiac/provider-gcp/nomad/main.tf— passes Redis config to dashboard-api moduleTest plan
go build ./...passes forauth,api, anddashboard-apipackagesgo test ./...passes forauthanddashboard-apipackages🤖 Generated with Claude Code