Search⌘ K
AI Features

The Cache-on-Demand Strategy

Explore the cache-on-demand strategy that allows users to trigger caching of assets through interactions like saving articles. Understand how this approach differs from dynamic caching and how to implement it for offline support in progressive web applications.

We'll cover the following...

The workings of the strategy

Developers might not be sure about pre-caching some assets. In these situations, it’s best to let the users decide if they want to cache those assets for the future. The caching strategy used in this situation is cache-on-demand, in which the user triggers the caching in the form of events like clicking a “Save” or “Download” button.

Remember that the cache-on-demand strategy doesn’t work with dynamic cache, as the latter stores the assets without the user’s intention. Another thing to remember is that this strategy requires the user ...