Harshdev625 / Harshdev625/TimeMachine

Add Redis caching for session endpoints to improve performance

オープン
#61 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement hacktoberfest
主要言語
JavaScript
スター
12
フォーク
28
PR マージ指標
30日以内にマージされた PR はありません

説明

## 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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。