Understand Caching and LRU Cache

Learn about the need for caches and one particular cache type: the least recently used cache.

Understand the need for cache

Let's start with an example. You've likely heard about Domain Name System (DNS) servers. A DNS server is a directory consisting of domain names and their corresponding IP addresses so the user can reach a server. For example, when go to the URL https://www.educative.io in a browser, the following operations are performed:

  1. The request hits a DNS server, which can be maintained by your Internet Service Provider (ISP).

  2. In the DNS server, the URL is mapped to its IP address, because all the servers and websites are hosted on a physical computer.

  3. This IP address is used to hit the server hosting the website. The server sends a response and the web page is displayed in our browsers.

The graphic below illustrates this process:

Get hands-on with 1200+ tech skills courses.