Skip to content

Implement external cache storage for AI service scalability #13

Description

@ErnieAtLYD

Problem

Currently the AI reflection service uses in-memory Maps for caching and rate limiting, which doesn't scale horizontally and could cause memory leaks in high-traffic scenarios.

Solution

Migrate to external cache storage (Redis recommended) for production scalability.

Tasks

  • Add Redis client configuration and connection handling
  • Replace in-memory cache Map with Redis-backed caching
  • Replace in-memory rate limiting with Redis-backed rate limiting
  • Add Redis connection health checks
  • Update environment configuration for Redis settings
  • Add Redis to deployment documentation

Acceptance Criteria

  • Multiple server instances can share cache and rate limiting state
  • Memory usage remains constant under load
  • Cache hit/miss ratios are maintained or improved
  • Rate limiting works correctly across multiple instances

Priority

Medium - Important for production scale but current implementation works for initial deployment

Related

Addresses scalability concerns from PR #12 code review

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions