Loading…

Cache API Playground

The Cache API lets a website save responses for URLs, so they can be loaded again later without asking the server. It is a key part of how offline websites and service workers work.

This playground gives you your own real cache. You store a response for a URL, then try to match it again, so you can see a cache hit and a cache miss for yourself.

Things to try

  • Store a JSON response for a URL with PUT.
  • Read it back with MATCH and see a cache hit.
  • MATCH a URL you never stored and see a cache miss.
  • LIST everything in the cache, then DELETE one entry.

How it works

Write one command per line: PUT a URL and a body, MATCH a URL, DELETE a URL, or LIST all entries. Lines starting with # or // are comments.

The commands use the real caches API with real Request and Response objects. Each playground uses its own named cache, so it never touches anything else stored by this site.

Frequently asked questions

What is the Cache API?

It is a browser API for saving pairs of requests and responses, so a website can reuse a response later instead of downloading it again.

Is the Cache API the same as the browser's HTTP cache?

No. The HTTP cache is managed by the browser automatically. The Cache API is controlled by the website's own code, which decides what to store and when to remove it.

Do I need a service worker to use it?

No. Service workers often use the Cache API, but normal page code can use it too, which is what this playground does.