Unverified Commit 7a62bbff authored by Sebastian Markbåge's avatar Sebastian Markbåge Committed by GitHub

Implement cacheScope by caching a Promise<CacheEntry> (#71286)

The cacheScope needs to contain the full CacheEntry, not just the
stream, so that it can transfer tag/life to the parent scope when it's
used.

I needed to do some refactoring. The tricky bit is that we want to store
a Promise into both the cacheHandler and the cacheScope as early as
possible to ensure they can dedupe and future requests while it's still
pending.
parent 3cde42ff
......@@ -5,8 +5,6 @@ async function getCachedRandom() {
export async function GET() {
const rand1 = await getCachedRandom()
// TODO: Remove this extra micro task when bug in use cache wrapper is fixed.
await Promise.resolve()
const rand2 = await getCachedRandom()
const response = JSON.stringify({ rand1, rand2 })
......
......@@ -5,8 +5,6 @@ async function getCachedRandom() {
export async function GET() {
const rand1 = await getCachedRandom()
// TODO: Remove this extra micro task when bug in use cache wrapper is fixed.
await Promise.resolve()
const rand2 = await getCachedRandom()
const response = JSON.stringify({ rand1, rand2 })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment