Skip to content

feat: wire cache adapter into request path and add cached flag - #11

Merged
joeykamsteeg merged 2 commits into
developfrom
feature/response-apply-cache
Aug 2, 2026
Merged

feat: wire cache adapter into request path and add cached flag#11
joeykamsteeg merged 2 commits into
developfrom
feature/response-apply-cache

Conversation

@joeykamsteeg

Copy link
Copy Markdown
Member

Summary

  • createFetchify now actually uses the configured cache adapter: GET requests check the cache before hitting the network, and successful (ok) GET responses are written back, keyed by method + resolved URL. Non-GET requests and non-ok responses never touch the cache.
  • FetchifyResponse<T> gains a required cached: boolean field (BREAKING).
  • createCacheAdapter accepts an optional second options: { cacheTtlMs?: number } argument to set a default TTL applied to set calls that omit one; an explicit ttlMs on set always wins. TTL is configured only at the adapter — not on FetchifyOptions.

Test plan

  • bun test (51 tests pass)
  • bun run lint
  • tsc --noEmit
  • Changeset added (major, breaking cached field)
  • OpenSpec change apply-cache-mechanism implemented, spec deltas synced into openspec/specs/cache-adapters and openspec/specs/http-client, and archived

🤖 Generated with Claude Code

joeykamsteeg and others added 2 commits August 2, 2026 13:45
Apply the configured cache adapter during GET requests instead of
silently ignoring it: cache hits skip the network, successful
responses populate the cache, and FetchifyResponse gains a required
`cached` boolean. TTL is configured via createCacheAdapter's new
optional `cacheTtlMs`, kept as the single place to control expiry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sync the cache-adapters and http-client delta specs into the main
specs, and move the completed change into openspec/changes/archive/.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@joeykamsteeg
joeykamsteeg merged commit 0709936 into develop Aug 2, 2026
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.

1 participant