Skip to content

docs(cache): invalidation using ocache#4216

Merged
pi0 merged 2 commits into
mainfrom
feat/cache-invalidation
Apr 22, 2026
Merged

docs(cache): invalidation using ocache#4216
pi0 merged 2 commits into
mainfrom
feat/cache-invalidation

Conversation

@RihanArfan
Copy link
Copy Markdown
Member

🔗 Linked issue

Closes #3969

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Updates cache invalidation to use ocache's new invalidation methods

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@RihanArfan RihanArfan requested a review from pi0 as a code owner April 20, 2026 15:13
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nitro.build Ready Ready Preview, Comment Apr 20, 2026 3:13pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

📝 Walkthrough

Walkthrough

Documentation updated to document runtime cache invalidation methods: an .invalidate() method exposed by defineCachedFunction-created cached functions and an invalidateCache helper from ocache. Previous invalidation example was replaced while retaining the cache keys description.

Changes

Cohort / File(s) Summary
Cache Invalidation Documentation
docs/1.docs/7.cache.md
Replaced "Cache keys and invalidation" section with "Cache invalidation" section documenting two runtime invalidation methods: .invalidate(...args) method on cached functions and invalidateCache helper. Removed legacy useStorage('cache').removeItem(...) example while preserving cache key generation patterns.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'docs(cache): invalidation using ocache' follows conventional commits format with proper type and scope.
Description check ✅ Passed The PR description clearly relates to the changeset, explaining the update to cache invalidation using ocache's new methods and linking to issue #3969.
Linked Issues check ✅ Passed The PR documentation changes address the primary objective of issue #3969 by documenting the new programmatic cache invalidation mechanism using ocache methods.
Out of Scope Changes check ✅ Passed All changes are scoped to documentation updates for cache invalidation, directly relevant to issue #3969 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cache-invalidation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
docs/1.docs/7.cache.md (1)

362-379: Include base in the invalidateCache example for consistency.

On Line 362 and Line 378, the text says base must match, but the example on Line 367–Line 374 does not show it. Adding base in options would make this safer for users with non-default cache mounts.

Proposed doc tweak
 await invalidateCache({
   options: {
     name: "ghStars",
     group: "nitro/functions",
+    base: "cache",
     getKey: (repo: string) => repo,
   },
   args: ["unjs/nitro"],
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/1.docs/7.cache.md` around lines 362 - 379, Update the invalidateCache
example to include the base option so it matches the text and prevents
mismatches for non-default cache mounts: modify the call to invalidateCache (the
options object passed to invalidateCache) to include base alongside name, group,
and getKey, ensuring the example shows the same base value users must match when
defining the cached function.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/1.docs/7.cache.md`:
- Around line 362-379: Update the invalidateCache example to include the base
option so it matches the text and prevents mismatches for non-default cache
mounts: modify the call to invalidateCache (the options object passed to
invalidateCache) to include base alongside name, group, and getKey, ensuring the
example shows the same base value users must match when defining the cached
function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f6458ab8-8dc0-4439-8489-a9792bcb93c8

📥 Commits

Reviewing files that changed from the base of the PR and between e3e654c and 5e4382a.

📒 Files selected for processing (1)
  • docs/1.docs/7.cache.md

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 20, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4216

commit: 5e4382a

Copy link
Copy Markdown
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thnx!

@pi0 pi0 merged commit 6b238f3 into main Apr 22, 2026
12 checks passed
@pi0 pi0 deleted the feat/cache-invalidation branch April 22, 2026 11:52
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.

Programmatic cache invalidation online

2 participants