DNS cache – What does it mean?
The DNS cache is a kind of temporary cache memory that DNS resolvers and different devices have. Inside that memory are stored earlier applied DNS records of searched domain names. These records hold the IP addresses (IPv4 or IPv6) of the domain names and their subdomains, also data about their email server, information for their services, authentication and verification data, and more. All of the information is going to be stored inside the DNS cache. As we mentioned, it is going to be only for a particular amount of time which is defined by the TTL (Time to Live) value that each DNS record has.
How does it work?
A DNS lookup is triggered every time a user requests a domain name. The first step of this search process is checking into the device’s DNS cache included in its operating system (OS). It is associated with a database where many DNS records are stored and their matching TTL values.
The one responsible for setting the TTL value is the DNS administrator of the domain. Therefore, the requested DNS records could be found there in a case when the TTL is not expired. The DNS query will find its answer, and the domain is going to load quickly.
In a scenario where the TTL has already expired is going to require further steps for finding the needed information. That includes added time for completing the process.
A DNS recursive server will receive the request of the user and proceed by checking for the needed DNS records in other servers. First, it is going to query the root server that should point to the TLD server responsible for the domain. Next, the TLD server shows to the recursive DNS server, which is the authoritative DNS server that holds all of the DNS records for that specific domain name. The recursive server obtains the needed data and gets back to the browser of the user.
Lastly, the domain is loaded, and the user is able to visit and explore the website. The DNS data is going to be saved for a particular amount of time in the DNS cache of the user’s device and the recursive server. That way, it will be easily accessible for the next time when the user wants to visit the same domain name.
DNS cache – How to delete it?
The DNS cache could be deleted in several ways. It depends on the browser you utilize and on your OS.
Linux (Ubuntu 20.04 LTS)
- You should open the Terminal. Next, type the following command – sudo systemd-resolve –flush-caches.
- Next, write your sudo password and press Enter. You are ready!
macOS
- You should open the Terminal. Next, type the following command – sudo killall -HUP mDNSResponder.
- Next, write your password and press Enter. You are ready!
Windows
- Start by opening the Command Prompt or Windows PowerShell. Next, type the following command – ipconfig /flushdns.
- You should receive a confirmation message. You are ready!
Edge/Google Chrome/Opera
- Copy this line – chrome://net-internals/#dns.
- Paste the line inside your address bar. Press Enter.
- On the page, you will see find “Host resolver cache” and click on “Clear host cache.”
- Ready!
Safari
- Go to “Preferences” and then go to “Advanced.” There, in the menu bar, search for “Show develop menu.”
- Then, find “Develop” and next “Empty Caches.”
- Restart your browser.
- You are ready!