Skip to content

Conversation

conico974
Copy link
Collaborator

@conico974 conico974 commented Jul 25, 2025

Fix regional cache for the DOShardedTagCache.
I open it as a draft PR for now.
Fix #819

This implementation will store every single tag in their own cache entry.

I think we should add an option to the tag cache.
It may make sense for some cases to store all the tag from hasBeenRevalidated in the same cache entry. It could be faster, but will likely ends up with less cache hit.
After some thought, i don't think it's worth it, the only times where it could be useful would be if you don't use (or barely) the data cache, and that you have very few ISR/SSG cache entry. Maybe an improvement to do in another PR.

Copy link

changeset-bot bot commented Jul 25, 2025

🦋 Changeset detected

Latest commit: a3e0889

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Jul 25, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@820

commit: a3e0889

return Math.max(...cachedValue.map((item) => item.time));
}
// Otherwise we need to check the durable object on the ones that were not found in the cache
const filteredTags = tags.filter((tag) => !cachedValue.some((item) => item.tag === tag));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const filteredTags = tags.filter((tag) => !cachedValue.some((item) => item.tag === tag));
const filteredTags = deduplicatedTags.filter((tag) => !cachedValue.some((item) => item.tag === tag));

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

LGTM, one nit
Thanks for the fix!

@vicb
Copy link
Contributor

vicb commented Jul 28, 2025

Could you please add a changeset

@conico974 conico974 marked this pull request as ready for review July 28, 2025 10:02
@conico974 conico974 merged commit c202302 into main Jul 28, 2025
7 of 8 checks passed
@conico974 conico974 deleted the conico/fix-regional-tag-cache branch July 28, 2025 10:12
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.

Incorrect regional tag cache for DOShardedTagCache

2 participants