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
-
Connection Setup: Ensure Redis connection is properly established with error handling and reconnection logic
-
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
-
Cache Invalidation: Set up proper cache invalidation when data is updated. For example, when a course is edited, its cached version should be cleared.
-
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.
-
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
- Redis connection is stable and handles disconnections gracefully
- Frequently accessed endpoints return cached responses when available
- Cache is properly invalidated when underlying data changes
- Response times for cached endpoints are significantly faster than uncached
- 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.
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
Connection Setup: Ensure Redis connection is properly established with error handling and reconnection logic
Caching Strategy: Implement caching for appropriate endpoints such as:
Cache Invalidation: Set up proper cache invalidation when data is updated. For example, when a course is edited, its cached version should be cleared.
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.
Environment Configuration: Make Redis connection details configurable through environment variables for different deployment environments.
Technical Context
The project already has the
redispackage 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
Testing
The implementation should be testable locally with a Redis instance. Include instructions for local Redis setup in the documentation if not already present.