🎯 Issue Type
📋 Description
Problem/Need
Older endpoints in apps/backend/src/routes/repositoryRoutes.ts still implement their own caching logic: they manually set and get Redis keys and clone a repository via withTempRepository() on each call. This bypasses the Cache Service and HybridLRUCache described in the Caching System documentation. As a result, commit data is cloned multiple times, aggregated data is recomputed unnecessarily, and manual Redis operations ignore tier promotion and cache invalidation semantics.
Expected Behavior
- All routes should delegate caching to
getCachedCommits(), getCachedAggregatedData() and getCachedContributors() from repositoryCache.ts.
- The unified cache should handle lookups across memory, disk, and Redis tiers, including automatic promotion, fallback, and invalidation.
- Redis remains part of the storage tier; the change removes only the manual cache handling from route handlers.
Current Behavior
- Endpoints like
POST /api/repositories, /heatmap, /contributors, and /full-data check Redis directly, clone the repository, and recompute commits or aggregations.
- They do not leverage multi‑tier caching, resulting in duplicated Git operations and inconsistent cache invalidation.
🔄 Steps to Reproduce
- Spin up the backend and send a
POST to /api/repositories with a repo URL.
- Immediately call
POST /api/repositories/heatmap with the same URL.
- Observe that the second call clones the repo again instead of using cached commit data (logs show duplicate
gitService.getCommits() calls).
- Compare to the new
GET /api/commits and GET /api/commits/heatmap endpoints, which reuse cached data via the cache service.
🎨 Mockups/Screenshots
// Current manual caching (simplified)
const commitsKey = `commits:${repoUrl}`;
const cached = await redis.get(commitsKey);
if (!cached) {
const commits = await withTempRepository(repoUrl, (dir) => gitService.getCommits(dir));
await redis.set(commitsKey, JSON.stringify(commits));
}
// Proposed unified caching usage
const cacheOptions: CommitCacheOptions = { skip: 0, limit: 1000 };
const commits = await getCachedCommits(repoUrl, cacheOptions);
See Hybrid LRU Cache – Three‑Tier Storage Architecture for details on memory, disk, and Redis tiers and Cache Service for the unified API.
🧪 Acceptance Criteria
🛠 Technical Details
Affected Files/Components
apps/backend/src/routes/repositoryRoutes.ts
apps/backend/src/services/repositoryCache.ts (import/export usage)
- Test suites for repository routes.
Dependencies
- None, though ensure configuration (
config.ts) still enables Redis if desired.
Breaking Changes
🏷 Categorization
Scope
Priority
Effort
📝 Additional Notes
- This refactor does not remove Redis from the caching infrastructure. It aligns the older routes with the multi‑tier cache design, as described in the Cache Invalidation and Hybrid LRU Cache pages.
- The repository’s cache configuration can still disable Redis if desired via
enableRedis, but that change would be separate.
🎯 Issue Type
📋 Description
Problem/Need
Older endpoints in
apps/backend/src/routes/repositoryRoutes.tsstill implement their own caching logic: they manually set and get Redis keys and clone a repository viawithTempRepository()on each call. This bypasses the Cache Service and HybridLRUCache described in the Caching System documentation. As a result, commit data is cloned multiple times, aggregated data is recomputed unnecessarily, and manual Redis operations ignore tier promotion and cache invalidation semantics.Expected Behavior
getCachedCommits(),getCachedAggregatedData()andgetCachedContributors()fromrepositoryCache.ts.Current Behavior
POST /api/repositories,/heatmap,/contributors, and/full-datacheck Redis directly, clone the repository, and recompute commits or aggregations.🔄 Steps to Reproduce
POSTto/api/repositorieswith a repo URL.POST /api/repositories/heatmapwith the same URL.gitService.getCommits()calls).GET /api/commitsandGET /api/commits/heatmapendpoints, which reuse cached data via the cache service.🎨 Mockups/Screenshots
See Hybrid LRU Cache – Three‑Tier Storage Architecture for details on memory, disk, and Redis tiers and Cache Service for the unified API.
🧪 Acceptance Criteria
redis.get/setlogic from older routes.gitServicecalls withgetCachedCommits,getCachedAggregatedData, andgetCachedContributors.🛠 Technical Details
Affected Files/Components
apps/backend/src/routes/repositoryRoutes.tsapps/backend/src/services/repositoryCache.ts(import/export usage)Dependencies
config.ts) still enables Redis if desired.Breaking Changes
🏷 Categorization
Scope
Priority
Effort
📝 Additional Notes
enableRedis, but that change would be separate.