-
Notifications
You must be signed in to change notification settings - Fork 41
[cloudflare]: add docs for withFilter
#132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -94,12 +94,18 @@ import { defineCloudflareConfig } from "@opennextjs/cloudflare"; | |||||
import r2IncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/r2-incremental-cache"; | ||||||
import d1NextTagCache from "@opennextjs/cloudflare/overrides/tag-cache/d1-next-tag-cache"; | ||||||
import doQueue from "@opennextjs/cloudflare/overrides/queue/do-queue"; | ||||||
//import { withFilter, softTagFilter } from "@opennextjs/cloudflare/overrides/tag-cache/tag-cache-filter"; | ||||||
|
||||||
export default defineCloudflareConfig({ | ||||||
incrementalCache: r2IncrementalCache, | ||||||
queue: doQueue, | ||||||
// This is only required if you use On-demand revalidation | ||||||
tagCache: d1NextTagCache, | ||||||
//If you don't use `revalidatePath`, you can also filter internal soft tags using the `softTagFilter` | ||||||
// tagCache: withFilter({ | ||||||
// tagCache: d1NextTagCache, | ||||||
// filterFn: softTagFilter, | ||||||
// }), | ||||||
}); | ||||||
``` | ||||||
|
||||||
|
@@ -449,7 +455,7 @@ Which one to choose should be based on two key factors: | |||||
|
||||||
If either of these factors is significant, opting for a sharded database is recommended. Additionally, incorporating a regional cache can further enhance performance. | ||||||
|
||||||
<Tabs items={["D1NextTagCache", "doShardedTagCache"]}> | ||||||
<Tabs items={["D1NextTagCache", "doShardedTagCache", "withFilter"]}> | ||||||
<Tabs.Tab> | ||||||
|
||||||
**Create a D1 database and Service Binding** | ||||||
|
@@ -588,5 +594,32 @@ doShardedTagCache takes the following options: | |||||
- `numberOfHardReplicas`: Number of replicas for the hard tag shards | ||||||
- `maxWriteRetries`: The number of retries to perform when writing tags | ||||||
|
||||||
</Tabs.Tab> | ||||||
<Tabs.Tab> | ||||||
<Callout> | ||||||
The withFilter option is a specialized configuration that enhances your tagCache by layering an additional filter. It requires another tag cache to be passed in as the originalTagCache (e.g., `d1NextTagCache`, `doShardedTagCache` or your own). | ||||||
</Callout> | ||||||
This enhanced tag cache selectively filters which tags trigger revalidations, allowing you to focus on a specific subset and reduce unnecessary load on the underlying tag cache. For convenience, we provide the ready-to-use softTagFilter that automatically filters out tags used within the `revalidatePath` function. Using this filter will break the `revalidatePath` function. | ||||||
|
This enhanced tag cache selectively filters which tags trigger revalidations, allowing you to focus on a specific subset and reduce unnecessary load on the underlying tag cache. For convenience, we provide the ready-to-use softTagFilter that automatically filters out tags used within the `revalidatePath` function. Using this filter will break the `revalidatePath` function. | |
This enhanced tag cache selectively filters which tags trigger revalidations, allowing you to focus on a specific subset and reduce unnecessary load on the underlying tag cache. For convenience, we provide the ready-to-use `softTagFilter` that automatically filters out tags used by the `revalidatePath` function making it a no-op. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
originalTagCache
->tagCache