Skip to content

Commit d6d5734

Browse files
committed
tweak LRU sentinel cache key (#89123)
We originally prefixed the TTL sentinel with the null-byte separator to avoid collisions with real invocation IDs, but that makes `extractInvocationID` return "ttl" instead of undefined for TTL-mode keys. This switches to a reserved magic string sentinel so TTL-mode entries are correctly treated as “no invocation ID”.
1 parent 4324698 commit d6d5734

File tree

1 file changed

+2
-3
lines changed
  • packages/next/src/server/response-cache

1 file changed

+2
-3
lines changed

packages/next/src/server/response-cache/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ const KEY_SEPARATOR = '\0'
6363

6464
/**
6565
* Sentinel value used for TTL-based cache entries (when invocationID is undefined).
66-
* Uses KEY_SEPARATOR prefix to guarantee uniqueness since null bytes cannot appear
67-
* in HTTP headers (RFC 7230), making collision with real invocation IDs impossible.
66+
* Chosen to be a clearly reserved marker for internal cache keys.
6867
*/
69-
const TTL_SENTINEL = `${KEY_SEPARATOR}ttl`
68+
const TTL_SENTINEL = '__ttl_sentinel__'
7069

7170
/**
7271
* Entry stored in the LRU cache.

0 commit comments

Comments
 (0)