Skip to content

feat: add opt-in cache invalidation via invalidate option - #26

Merged
joeykamsteeg merged 2 commits into
developfrom
feature/cache-invalidation
Aug 7, 2026
Merged

joeykamsteeg merged 2 commits into
developfrom
feature/cache-invalidation

Conversation

@joeykamsteeg

Copy link
Copy Markdown
Member

Summary

  • FetchifyMethodOptions gains an optional invalidate?: boolean | (string | URL)[], honored on every HTTP method, not just mutating verbs.
  • When a request's response resolves as a live (non-cache-hit) ok response on a client configured with cache: invalidate: true deletes the GET cache entry for that request's own resolved URL, and an array of string | URL entries resolves each one (same rules as request-path resolution) and deletes its GET cache entry.
  • No automatic invalidation of any kind — omitting invalidate (or false/[]) leaves cache behavior exactly as it was before this change. Each entry is invalidated independently, so a CacheAdapter.delete failure for one never blocks the rest or affects the resolved response.
  • OpenSpec change add-cache-invalidation-on-mutations fully implemented (27/27 tasks) and its delta specs synced into openspec/specs/ (new cache-invalidation capability, updated cache-adapters).

Test plan

  • bun test — 288 pass, 0 fail
  • bun run build — clean
  • bun run lint — clean
  • openspec validate --changes / --specs — all pass

🤖 Generated with Claude Code

joeykamsteeg and others added 2 commits August 8, 2026 00:30
FetchifyMethodOptions gains invalidate?: boolean | (string | URL)[], honored
on any HTTP method whenever a live ok response resolves on a client
configured with cache: true purges the request's own GET cache entry, and
an array purges each resolved entry. No automatic invalidation of any kind.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Syncs the delta specs from add-cache-invalidation-on-mutations into
openspec/specs/: adds the cache-invalidation capability and updates
cache-adapters' non-GET bypass requirement to describe the invalidate
exception.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

test: Run #40

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Duration ⏱️
288 288 0 0 596ms

🎉 All tests passed!

Github Test Reporter by CTRF 💚

@joeykamsteeg
joeykamsteeg merged commit b49e981 into develop Aug 7, 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