Skip to content

[Enhancement] Redis cache layer is not properly configured for production use #2

Description

@zeemscript

What's Happening

The Redis caching layer is not properly set up and configured. This means the backend is not benefiting from caching, leading to repeated database queries for the same data and slower response times overall.

Current State

Redis is listed as a dependency in the project but the caching strategy is either incomplete or not working as intended. The setup guides exist in the repo but the actual implementation needs work.

What Needs To Be Done

  1. Connection Setup: Ensure Redis connection is properly established with error handling and reconnection logic

  2. Caching Strategy: Implement caching for appropriate endpoints such as:

    • Course listings and details
    • Book listings and details
    • User profile data
    • Other frequently accessed but rarely changing data
  3. Cache Invalidation: Set up proper cache invalidation when data is updated. For example, when a course is edited, its cached version should be cleared.

  4. TTL Configuration: Configure appropriate time to live values for different types of cached data. Frequently changing data needs shorter TTL while static content can have longer TTL.

  5. Environment Configuration: Make Redis connection details configurable through environment variables for different deployment environments.

Technical Context

The project already has the redis package installed. The implementation needs to integrate with the existing Express middleware and controller structure. Consider using a caching middleware pattern that can be easily applied to routes.

Acceptance Criteria

  1. Redis connection is stable and handles disconnections gracefully
  2. Frequently accessed endpoints return cached responses when available
  3. Cache is properly invalidated when underlying data changes
  4. Response times for cached endpoints are significantly faster than uncached
  5. Configuration works across development, staging, and production environments

Testing

The implementation should be testable locally with a Redis instance. Include instructions for local Redis setup in the documentation if not already present.

Metadata

Metadata

Labels

GrantFox OSSPart of the GrantFox OSS programMaybe RewardedPotential reward for completionOfficial Campaign | FWC26GrantFox official campaign FWC26complexity:highMaps to Drips Wave High tier (200 pts)enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions