Skip to content

feat: implement production-grade API response caching (#207)#345

Merged
RUKAYAT-CODER merged 1 commit intorinafcode:mainfrom
TochukwuJustice:fix-cache
Apr 28, 2026
Merged

feat: implement production-grade API response caching (#207)#345
RUKAYAT-CODER merged 1 commit intorinafcode:mainfrom
TochukwuJustice:fix-cache

Conversation

@TochukwuJustice
Copy link
Copy Markdown
Contributor

closes #207
Summary of Changes:

Integrated a caching layer into ApiClientImpl using a Map-based store.
Implemented Stale-While-Revalidate (SWR) logic: fresh hits return instantly, while stale hits return immediately and trigger a background refresh.
Added Security Isolation: Cache keys are generated using a composite of the URL and the user's Authorization token to prevent cross-user data leakage.
Added Automatic Invalidation: Successful POST, PUT, PATCH, and DELETE requests automatically evict the relevant cache entry.
Updated public method signatures (get, post, etc.) to allow opt-in caching via { useCache: true, ttl: number }.
Reason for Changes: To address issue #207 by reducing redundant network requests, improving frontend performance (lower perceived latency), and ensuring data remains fresh via background revalidation.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 28, 2026

@TochukwuJustice Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER RUKAYAT-CODER merged commit 2232e54 into rinafcode:main Apr 28, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing API Response Caching

2 participants