EVSM Studio

Edge Caching & Origin Protection

Edge Stale-While-Revalidate, Cache-Tag DAG Invalidation & Singleflight (2026)

Updated 2026-12-05 · Cloudflare Workers Performance · 5 min read

Direct Answer Pair RFC 5861 stale-while-revalidate with surrogate cache-tag dependency graphs and in-flight singleflight locks so origin databases serve 1 request per burst instead of 2,000 while edge latency stays under 10 ms.

1. Singleflight Stampede Coalescing

Track active misses in an in-memory promise map keyed by normalized cache key and vary headers so concurrent viewers share one upstream fill without exhausting connection pools.

if (!inflight.has(cacheKey)) {
  inflight.set(cacheKey, originFetch(req).finally(() => inflight.delete(cacheKey)));
}
return (await inflight.get(cacheKey)).clone();

2. Surrogate Cache-Tag Graphs & LRU vs LFU Modeling

Benchmark hit ratios between LRU and LFU eviction, simulate 2,000-request thundering herds, and download the Node/Python reference library inside CachePulse Kit ($49).

Run CachePulse Edge SWR & Singleflight Kit

Included inside the $79 27-Kit All-Access Commercial Pass with 8 Node tests and 5 Python tests.