feat(core): add per-request cache TTL and override options#3
Open
Andrchiamus wants to merge 3 commits intoAllyMurray:mainfrom
Open
feat(core): add per-request cache TTL and override options#3Andrchiamus wants to merge 3 commits intoAllyMurray:mainfrom
Andrchiamus wants to merge 3 commits intoAllyMurray:mainfrom
Conversation
Allow callers to override defaultCacheTTL and cacheOverrides on a per-request basis via get() options, following the same pattern already used for retry configuration. - Extract CacheOverrideOptions into a reusable exported interface - Add cacheTTL and cacheOverrides to HttpClientContract.get() options - Add resolveCacheConfig() for shallow-merging per-request over constructor - Thread resolved config through all cache paths (store, 304, SWR, ignoreNoStore, ignoreNoCache) - 9 new tests covering all per-request override scenarios Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The store-dynamodb#test override stripped the default test task's dependsOn, causing it to run before @http-client-toolkit/core was built. This resulted in a "Failed to resolve entry" error in CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ptions - Remove unused fallback to this.options.cacheOverrides in clampTTL (all call sites now pass overrides explicitly via resolveCacheConfig) - Add cacheTTL, cacheOverrides, headers, and retry to the README request options table so all get() options are discoverable Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
cacheTTLandcacheOverridesoptions toget()for per-request cache configuration, following the same override pattern used byretryCacheOverrideOptionsinto a reusable exported interface (previously inline inHttpClientOptions)ignoreNoStore,ignoreNoCacheUsage
Test plan
cacheTTLoverridesdefaultCacheTTL(no cache headers → uses request TTL)minimumTTLoverrides constructorminimumTTLmaximumTTLoverrides constructormaximumTTLignoreNoStore: trueforces caching despiteno-storeignoreNoCache: trueskips revalidationcacheTTLapplies inbackgroundRevalidate(SWR path)🤖 Generated with Claude Code