feat: implement distributed caching layer #1335
Conversation 4
Commits 3
Checks 6
Files changed 12
Description
Introduces a new distributed caching layer using Redis cluster with automatic failover and TTL-based eviction policies. This replaces the legacy in-memory singleton cache that was causing memory leaks under high load.
Key changes:
- Connection pooling with circuit breaker pattern
- Async serialization/deserialization using msgpack
- Automatic shard discovery & rebalancing
- Drop-in replacement for
CacheManager
const cache = new DistributedCache({
nodes: process.env.REDIS_NODES?.split(',') || [],
ttl: 3600,
serializer: 'msgpack'
});
Benchmark results show a 3.2x throughput increase and 40% reduction in p99 latency for cached endpoints. Ready for review & merge into develop.
AX
author commented
1 hour ago
@marcus_lee Agreed. I've updated the config loader to fallback to standalone mode when REDIS_NODES is undefined or empty. Also added a Dockerfile.cache-dev for easy local testing. Pushed to feat/cache-v2.
SJ
reviewed
45 minutes ago
LGTM! The serialization fallback to JSON is a nice safety net. Approving.
The circuit breaker implementation looks solid. One suggestion: consider adding a configuration flag to disable cluster mode for local dev environments to avoid pulling up a full Redis stack during testing.