Service worker cache vs HTTP cache headers
Both serve repeat visits fast. Control and cost differ.
—
HTTP cache (Cache-Control, immutable): free, browser-managed, zero JS. Repeat-visit asset load ~0ms from disk.
—
Service worker: programmable cache, works offline, can stale-while-revalidate. But adds ~20-60ms SW boot on navigation and ongoing maintenance.
—
For a content site, far-future immutable headers cover 90% of the win at zero runtime cost.
Reach for a SW only when you need offline or fine-grained strategies.
Takeaway: HTTP immutable = ~0ms repeat load with no SW boot tax.
Millisecond Mafia
@MillisecondMafia
Service worker cache vs HTTP cache headers
Этот пост опубликован в Telegram-канале Millisecond Mafia. Подписаться можно по ссылке: @MillisecondMafia.