tezvyn:

Cache API: Manual Control Over Network Responses

Source: developer.mozilla.orgadvanced

The Cache API is a key-value store for network requests you control directly, unlike the browser's automatic HTTP cache. Use it in service workers for offline support or to pre-cache app assets.

The Cache API is a persistent, script-controlled key-value store where keys are `Request` objects and values are `Response` objects, separate from the browser's automatic HTTP cache. It's essential for service workers in PWAs, enabling offline support by letting you intercept requests and serve cached responses. You can also pre-cache critical assets for instant loading. The main footgun: it completely ignores HTTP caching headers. You are responsible for all updates, versioning, and deleting stale entries.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Cache API: Manual Control Over Network Responses · Tezvyn