Caching lab using JavaScript


In this lab, you will learn how to implement caching using JavaScript. Caching is a technique to store data temporarily and make future requests faster by serving data from the cache. This lab will focus on implementing a basic in-memory cache for an example API call. You will learn about best practices for caching data and invalidating cache when the data changes.

Here's an outline of the lab:

  1. Create an HTML file with basic structure.
  2. Create a simple API call using Fetch API.
  3. Implement caching of the API result in memory.
  4. Add cache invalidation logic if new data is added or removed.
  5. Display data on the HTML page.

By the end of this lab, you will understand how caching works and how to implement it in your JavaScript code.