Backend Low Level Design 4
About Lesson
To update the cache, add a timestamp field to the map. For each request, check the current time against the timestamp. If more than 5 minutes have passed since the last update, refresh the cache and update the timestamp. If less than 5 minutes have passed, return the cached data.
update-cache
Client site caching
Whenever we visit a website, it doesn’t directly access the codebase. First, it contacts the DNS (Domain Name System), which then reaches out to the server. Since DNS entries don’t change frequently, it’s not efficient to query the DNS every time we request a website. Instead, browsers cache the DNS information in memory for the day, a process known as client-side caching. This is why, when we repeatedly access websites like google.com or geekysanjay.com throughout the day, the browser uses the cached DNS information.
clientside caching

© GeekySanjay