Harshdev625 / Harshdev625/TimeMachine

Add Redis caching for session endpoints to improve performance

Đang mở
#61 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement hacktoberfest
Ngôn ngữ chính
JavaScript
Star
12
Fork
28
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Problem Statement

- Currently, every time the user refreshes their dashboard or checks session history, the backend fetches data directly from MongoDB.
- This increases response time and database load, especially when users frequently start, pause, or complete sessions.

## Proposed Solution

- Add a Redis caching layer to temporarily store frequently accessed session data (/current, /history) for faster retrieval.

## Implementation idea:

- Use ioredis or redis npm package.

- Cache key format: session:${userEmail}

- Set a TTL of 5–10 minutes.

- Invalidate cache whenever session data is created, updated, or deleted.

## Alternatives Considered

- Using in-memory caching (e.g., node-cache) — but it wouldn’t scale across multiple backend instances.

- MongoDB indexing — helps query speed but doesn’t reduce repeated hits.

## Additional Context

- This would improve user experience on dashboards and analytics pages, reducing API response times by 30–50% while easing database loa

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.