Development

Cache

Cache (Temporary Storage)

Cache

A cache is a shortcut — it saves copies of things you use often so they load instantly instead of being fetched from scratch every time.

What it is

A cache (pronounced "cash") is a temporary storage layer that saves copies of frequently accessed data so it can be served faster the next time it is needed. Instead of fetching the same data from a slow source (like a or a distant server) every single time, the system stores a copy in a faster, closer location. When you visit a website for the second time and it loads much faster, that is caching at work — your saved copies of the images, fonts, and files from the first visit. Caching happens at many levels: in your browser, on servers, in databases, and across content delivery networks (CDNs). It is one of the most important techniques for making the Internet feel fast.


Real-world examples

  • Cache — when you visit YouTube, your browser caches the logo, styles, and files. The next time you visit, those files load from your computer instead of downloading again.
  • Instagram — Instagram caches photos you have already scrolled past. If you scroll back up, they load instantly instead of being downloaded again from the server.
  • Google Search — Google caches copies of web pages. When you click "Cached" on a search result, you see Google's stored copy, which can load even if the original website is down.
  • Netflix — Netflix caches popular shows on servers close to you (CDN). When millions of people watch the same show on a Friday night, Netflix does not stream it from one central location — it serves cached copies from nearby servers.

Analogies

  • A cache is like keeping your most-used tools on your desk instead of in the garage. You could walk to the garage () every time you need a pen, but it is much faster to keep one on your desk (cache). You only go to the garage when you need something you do not have on your desk.
  • Think of a cache like a waiter's notepad. Instead of going to the kitchen (server) to check every dish's ingredients each time a customer asks, the waiter writes down the most common answers and checks the notepad first. The kitchen is only consulted for unusual questions.
  • A cache is like speed dial on a phone. Instead of looking up a phone number in the directory () every time, you save your most-called numbers on speed dial (cache) for instant access.

Comparisons

Cache vs Database

  • A is the permanent, authoritative source of data — it stores everything and is built for .
  • A cache is a temporary, fast copy of data — it stores only frequently accessed items and is built for speed.
  • When data changes, the cache must be "invalidated" (cleared or updated) so it does not serve outdated information. This is one of the hardest problems in computer science.

Why it matters

Caching is what makes the Internet feel instant. Without it, every page load, every image, and every video would be fetched from distant servers every single time — making everything unbearably slow. When someone tells you to "clear your cache" to fix a website problem, they are asking you to delete the saved copies so your fetches fresh versions. Understanding caching helps you troubleshoot slow websites, understand why you sometimes see outdated content, and appreciate the engineering behind the fast digital experiences you use every day.

  • CDNCDN (Content Delivery Network)
  • SSRSSR (Server-Side Rendering)
  • Database (Dev)Database — Developer Perspective

Stay Updated

We only send updates about new content. No spam, ever.

Previous
Framework
Next
UX/UI