Skip to main content

Command Palette

Search for a command to run...

The Cache API: A quick guide to JS

Published
1 min read

The Cache API

The Cache API is a system for storing and retrieving network requests and their corresponding responses. These might be regular requests and responses created in the course of running your application, or they could be created solely to store data for later use.

The Cache API was created to enable service workers to cache network requests so that they can provide fast responses, regardless of network speed or availability. However, the API can also be used as a general storage mechanism.

What can be stored

The caches only store pairs of Request and Response objects, representing HTTP requests and responses, respectively. However, the requests and responses can contain any kind of data that can be transferred over HTTP.

how much can be stored?

In short, a lot, at least a couple of hundred megabytes, and potentially hundreds of gigabytes or more. Browser implementations vary, but the amount of storage available is usually based on the amount of storage available on the device.


Link1:https://web.dev/cache-api-quick-guide/

Link 2:MDN Web Docs related to cache API

https://developer.mozilla.org/en-US/docs/Web/API/Cache