2. Cached DNS Resolution:
A Domain Name System (DNS) translates domain names to IP addresses, which are then used by browsers to load internet resources. For quicker DNS lookups, browsers often store a number of recent DNS queries in a DNS cache. Retrieving data from the cache is often faster than retrieving it from a DNS server.
This task aims to simulate DNS resolution and determine the time taken to process different URLs. Assume that the DNS cache can store a maximum of the cache size most recent DNS requests, i.e., URL-IP mappings. The cache is initially empty. It takes cache time units of time to fetch data from the DNS cache, and server time units of time to fetch data from the DNS server.