What is caching?

Author: Kenneth ([email protected])

Published: Sunday March 14, 2021

Caching is the process of storing copies of files in a cache, or temporary storage location, so that they can be accessed more quickly. Technically, a cache is any temporary storage location for copies of files or data, but the term is often used in reference to Internet technologies. Web browsers cache HTML files, JavaScript, and images in order to load websites more quickly, while DNS servers cache DNS records for faster lookups and CDN servers cache content to reduce latency.

In this article, we will discuss browser caching for websites.

The benefits of caching

Caching improves and speeds up browsing. Once you’ve downloaded an asset, it lives (for a time) on your machine. Retrieving files from your hard drive will always be faster than retrieving them from a remote server, no matter how fast your Internet connection.

Some pitfalls

You’ve enabled asset caching for your website. The next day, you decide to change the color of your logo. You swap out the old logo for the new one and check your live website to see how it looks. But the old logo is still there.

Assuming you completed the image swap correctly, the problem is usually caching.

Your machine has a cached version of your logo on the hard drive. It never bothers to request a new download of the image. Therefore, your machine will not obtain the new logo until the cache file it has on hand expires.

Old versions of cached files cause all sorts of issues for users if their devices don’t have the latest version of the file – mismatched formatting, broken JavaScript and incorrect images are just a few.

For the most part, this doesn’t happen because the server knows which assets have been updated and need to be replaced on the user’s machine.

Clearing the cache

Clearing the cache just means emptying it, so the next time you display a webpage, everything must be downloaded anew so that your website loads all files correctly.

As a website owner, if one of your customers complains that the site is broken for them and no one else, then you should advise them to clear their browser cache.

If your a user, the first thing to do when a site is not loading properly is to clear your cache. Steps to clear your cache are below.

Ctrl + Shift + R or Ctrl + F5 is a keyboard shortcut used to perform a hard reload of a web page in Google Chrome, Edge and Firefox.