feat: implement production-grade API response caching (#207)#345
Merged
RUKAYAT-CODER merged 1 commit intorinafcode:mainfrom Apr 28, 2026
Merged
feat: implement production-grade API response caching (#207)#345RUKAYAT-CODER merged 1 commit intorinafcode:mainfrom
RUKAYAT-CODER merged 1 commit intorinafcode:mainfrom
Conversation
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.