Skip to main content
Q drop
Log in
Web Technology

Cache

Overview

A cache is a mechanism that keeps a copy of data you've already fetched close at hand, so that when the same data is needed again, the copy is used instead of going back for the original. The word comes from the French for "hiding place," with the image of tucking data away somewhere you can grab it quickly. Caches are used at every layer of computing, including web browsers, smartphone apps, CDNs, and databases.

How the browser cache works

When you visit a website, your browser downloads files such as HTML, CSS, JavaScript, and images to display the page. The browser cache saves these files locally, and on your next visit the browser uses the saved files instead of downloading them from the server again. This makes pages load faster and also cuts down on data usage.

The server decides how long cached files stay valid. Files that don't change often, like images and CSS, get longer expiration times, while data that should always be up to date, like API responses, is either not cached or given a short expiration time.

Cache-related problems and how to fix them

When you run into the problem of "I updated my website, but the old content still shows," the first suspect is the browser cache. Because the browser keeps using its copy of the old files, the latest files on the server don't show up.

The fix is to "clear the cache." In your browser settings, choose "Clear browsing data" and delete "Cached images and files." A quicker option is a hard reload with Ctrl+Shift+R (Cmd+Shift+R on a Mac), which ignores the cache and fetches the latest files from the server. If your question box looks wrong, it's a good idea to try clearing the cache first.

App caches and storage

Smartphone apps use caches too. Social media apps save images and videos you've viewed to their cache, so the cache can grow larger over time. If your phone is running out of storage, deleting an app's cache can sometimes free up space.

On iPhone, you can check how much space each app uses under "Settings > General > iPhone Storage." On Android, you can run "Clear cache" from "Settings > Storage" or from each app's info screen. Clearing the cache usually keeps your account information and login status. However, apps handle this differently, so it's a good idea to check the on-screen explanation before deleting. Also, the next time you open the app, it will need to download data again, so things may load slowly for a while.

Was this article helpful?

Related terms

Related articles

Want to create your own question box?

Sign up with just an email address. No password required.

Start for free