Commit d6d57349 authored by Zack Tanner's avatar Zack Tanner

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”.
parent 43246988
...@@ -63,10 +63,9 @@ const KEY_SEPARATOR = '\0' ...@@ -63,10 +63,9 @@ const KEY_SEPARATOR = '\0'
/** /**
* Sentinel value used for TTL-based cache entries (when invocationID is undefined). * Sentinel value used for TTL-based cache entries (when invocationID is undefined).
* Uses KEY_SEPARATOR prefix to guarantee uniqueness since null bytes cannot appear * Chosen to be a clearly reserved marker for internal cache keys.
* in HTTP headers (RFC 7230), making collision with real invocation IDs impossible.
*/ */
const TTL_SENTINEL = `${KEY_SEPARATOR}ttl` const TTL_SENTINEL = '__ttl_sentinel__'
/** /**
* Entry stored in the LRU cache. * Entry stored in the LRU cache.
......
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