Skip to content
Diego van Haaster edited this page May 13, 2021 · 1 revision

cache-first:

  1. You query for some data. Client checks the cache for the data. If all of the data is present in the cache, skip directly to step 4.
  2. If the cache is missing some of the data you asked for, Client will make a network request to your API.
  3. The API responds with the data, Client uses it to update the cache.
  4. The requested data is returned.

cache-and-network:

  1. You query for some data. Client checks the cache for the data.
  2. If the data is in the cache, return that cached data.
  3. Regardless of whether any data was found in step two, pass the query along to the API to get the most up-to-date data.
  4. Update the cache with any new data from the API.
  5. Return the updated API data.

network-only:

  1. Client makes a network request for your data without checking the cache.
  2. The server responds with your data and the cache is updated.
  3. The data is returned.

no-cache:

  1. Client makes a network request for your data without checking the cache.
  2. The server responds and the data is returned without updating the cache.

cache-only:

  1. Client checks the cache for queried data.
  2. If all the data is present in the cache, it is returned (otherwise, an error is thrown).
Clone this wiki locally