-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements prefetching support for interception routes using the Segment Cache. The overall flow is the same as the previous prefetch cache implementation. If a page varies based on the Next-URL — in other words, if it might possibly be intercepted — we include the Next-URL as part of the cache key. However, since most pages do not vary on the Next-URL, and this is known at build time, for most pages we can omit the Next-URL from the cache key for all but the first request. We do this by checking the Vary header of the first response, and if the Next-URL is not included, we re-key the cache entry to remove the Next-URL. All subsequent requests for the same page will match this entry regardless of the Next-URL. --- One difference from the previous prefetch cache implementation: when an entry varies by Next-URL, rather than concatentating the Next-URL to the href to create a combined cache key, we store the entries in a tiered map structure whose keys are tuples of the href and Next-URL. Then we compare each key part separately. This might end up being overkill but it's nice because we don't have to worry about escaping the values, nor do we have to store an encoded cache key separately from its individual parts. We will likely use the same approach for storing segment cache entries, which vary on both the segment path and (in some cases; not yet implemented) the search params.
- Loading branch information
Showing
11 changed files
with
347 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.