A cache is a temporary storage layer that keeps copies of frequently accessed data so it can be retrieved faster next time. Imagine keeping your most-used textbooks on your desk instead of walking to the bookshelf every time you need them. The desk is your cache - it holds a small amount of data that you can grab instantly, saving the time of fetching it from the original source.
Browser cache is the most familiar type. When you visit a website for the first time, your browser downloads and saves images, CSS files, JavaScript, and other assets locally. On your next visit, the browser loads these saved files instead of downloading them again, making the page appear much faster. This is why websites you visit regularly load noticeably quicker after the first visit.
DNS cache is another important example. When your browser translates a domain name (like google.com) into an IP address, it stores the result in a local cache. The next time you visit the same domain, the browser skips the DNS lookup entirely and uses the cached IP address, shaving milliseconds off the connection time.
Every cached item has an expiration period controlled by a setting called TTL (Time To Live). When the TTL expires, the cached data is considered stale and discarded. The next request for that data triggers a fresh fetch from the original server. Web developers set TTL values strategically - static assets like logos might be cached for months, while dynamic content might have a TTL of just minutes.
Cache behavior has interesting implications for short URLs. When a browser caches a 301 (permanent) redirect, subsequent clicks on the same short URL bypass the shortening service's server entirely - the browser redirects directly to the destination. This is faster for the user but means the shortening service cannot count those repeat clicks in its analytics. Some services use 302 (temporary) redirects specifically to prevent caching and maintain accurate click tracking.
Occasionally, cached data causes problems. If a website updates its content but your browser still shows the old cached version, you can force a fresh load with Ctrl+F5 on Windows or Cmd+Shift+R on Mac. This tells the browser to ignore its cache and download everything from scratch. You can find related books on Amazon.