[GH-ISSUE #440] perf: TTL-based eviction sweep for prefetch cache #96

Closed
opened 2026-05-06 12:37:11 +02:00 by BreizhHardware · 0 comments

Originally created by @Divkix on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/440

Problem

The prefetch cache in navigation.ts stores RSC prefetch responses with a 30s TTL and a hard cap of 50 entries. Expired entries are only cleaned on individual access or displaced by FIFO when at capacity. This means expired entries waste slots, causing premature eviction of still-valid entries on link-heavy pages.

Solution

Sweep all expired entries before resorting to FIFO eviction in storePrefetchResponse(). This ensures fresh entries survive longer under pressure without increasing the cache size cap.

Implementation

PR: #434

Originally created by @Divkix on GitHub (Mar 11, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/440 ## Problem The prefetch cache in `navigation.ts` stores RSC prefetch responses with a 30s TTL and a hard cap of 50 entries. Expired entries are only cleaned on individual access or displaced by FIFO when at capacity. This means expired entries waste slots, causing premature eviction of still-valid entries on link-heavy pages. ## Solution Sweep all expired entries before resorting to FIFO eviction in `storePrefetchResponse()`. This ensures fresh entries survive longer under pressure without increasing the cache size cap. ## Implementation PR: #434
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#96
No description provided.