Skip to content
Launch GitLab Knowledge Graph

Setup Redis caching layer for recommendation results

Overview

Implement Redis caching to improve recommendation API performance.

Requirements

  • Redis Cluster setup (3 nodes minimum)
  • Cache key strategy: rec:{user_id}:{context}
  • TTL: 15 minutes for personalized recs
  • Cache invalidation on user actions

Configuration

REDIS_CONFIG = {
    "host": "redis-cluster.internal",
    "port": 6379,
    "db": 0,
    "max_connections": 50
}

Acceptance Criteria

  • Cache hit rate > 80%
  • Failover handling (fallback to DB)
  • Monitoring metrics exposed