Add opt-in client-side API caching for safe GET requests - #11
Merged
Merged
Conversation
Co-authored-by: Micfinch <142565130+Micfinch@users.noreply.github.com>
Co-authored-by: Micfinch <142565130+Micfinch@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add opt-in API caching layer for Mempool client
Add opt-in client-side API caching for safe GET requests
Sep 21, 2026
Micfinch
approved these changes
Sep 23, 2026
Micfinch
marked this pull request as ready for review
September 23, 2026 14:39
Owner
|
@copilot please fix the merge conflicts in this pull request. |
…-caching-layer # Conflicts: # src/index.ts Co-authored-by: Micfinch <142565130+Micfinch@users.noreply.github.com>
Author
Micfinch
approved these changes
Sep 27, 2026
Owner
|
@copilot please fix the merge conflicts in this pull request. |
Owner
|
@copilot please fix the merge conflicts in this pull request. |
…-caching-layer # Conflicts: # src/services/api/index.ts Co-authored-by: Micfinch <142565130+Micfinch@users.noreply.github.com>
Owner
|
@copilot please fix the merge conflicts in this pull request. |
Micfinch
approved these changes
Sep 27, 2026
Author
Author
The pull request is currently mergeable and I do not see any remaining merge conflicts to resolve.
The pull request is currently mergeable and I do not see any remaining merge conflicts to resolve. |
Micfinch
approved these changes
Sep 27, 2026
Micfinch
approved these changes
Sep 27, 2026
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.
This adds a client-side caching layer to the Axios-based Mempool client without changing default behavior: caching remains off unless the caller explicitly enables it. The implementation is scoped to safe/idempotent GETs, isolates cache entries by client configuration, and avoids caching authorization-bearing requests unless the caller deliberately opts into an isolated store.
Cache model
cacheconfiguration tomempoolJS(...)with:enabledttlMs(number or function)maxEntriesstoreallowAuthorizedRequestsshouldCacheclient.cache.clear()only when caching is enabled.Storage + isolation
mempoolJS.createMemoryCacheStore()for explicit isolated stores.Request behavior
GETrequests.POST/mutation requests.request.Security guards
authorization,cookie,proxy-authorization,set-cookie,x-api-key, orauth.Docs
README.mdwith cache configuration examples, TTL guidance, limitations, and security notes.Example: