cache.put
Despite what you might think, the add method do not let you cache a response directly. If you receive a network response from a fetch call, you would need to explicitly handle its caching. This is where the put method gives you the control needed to cache a response with the flexibility to use the response in parallel to the caching process.
As you will learn in the next chapter, there are many different caching strategies where a network response is cached once the network request resolves.
The put method has two parameters, request and response. These are the same Request and Response objects that were covered in the Fetch section.
The put method uses these two objects to catalog the assets in a key value fashion, sort of like ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access