Browsers

Cache Clearing: When, Why and How

Caching your browser in the act

I cringe every time I tell someone to clear their browser cache, for a couple of reasons: 1) They usually don’t know how to do it and 2) it’s another frustrating example of technology not “just working”. So why suggest it?

First, a definition: The browser cache is a space on your computer’s hard drive where files downloaded from web pages are stored. When the web page is revisited, these files are retrieved from the cache, which is much faster than downloading them again over the internet.

What could go wrong?

Modern websites deliver dozens of files to the browser for every page load (the Webdancers home page, which is fairly simple, delivers 55 files to the browser). Some of these files need to be downloaded every time and some are safe to cache. When the website owner makes changes to the page, the changed files must be downloaded again and re-cached if necessary. Some fairly complex communications take place between the server and browser to keep all this straight.

When things go wonky (a technical term), these are some of the things you might see:

  • Everything on the page becomes unformatted and jumbled up.
  • Images or text that should have changed have not.
  • Sections of the page are missing.
  • Buttons don’t function properly.

While it would take someone with more technical chops than I have to figure out exactly why things have gone wonky, it’s enough to know that the browser isn’t using the correct data for the task at hand.

Clearing the cache

What we need to do is clear (delete) the files from the browser cache, to make sure that the browser is getting files fresh and new from the web server. Every browser has it’s own procedure for clearing the cache. Before getting into that, there’s a quicker fix that you could try: Clicking the “refresh” button in the browser while holding down the shift key (or pressing Shift-F5) will cause the browser to request all new information while refreshing the page, leaving the cache unchanged. Honestly, it doesn’t solve the problem all that often but it’s worth a try.

For instructions on clearing the cache in all common browsers, check this page at Digital Trends and follow the instructions. If your browser is not current (shame on you), you may have to do a search for “clear cache” followed by your browser type and version.

Clearing the cache is a safe and fairly benign action. The only downside is that the next time you visit a website, all of the available files must be downloaded again, before they are re-cached. This might slow down the load time by a few seconds.

What about cookies?

Don’t clear the cookies if you can help it. While clearing the cache has no penalty other than a few extra seconds of loading time, clearing cookies will break the link between your browser and sites where you have previously signed in. This means that you’ll have to sign in again at every site, even those where you have selected “remember me”. Also, cookies are very rarely the cause of the problem.

Cache as cache can

There are other caches besides those in browsers and their purpose is the same: to speed up web page delivery by using data that can be accessed faster than it otherwise would be. For example:

  • WordPress cache plugins. WordPress stores all of its content in a database, retrieving the data needed to construct each page as it’s requested. Retrieving from the database is a relatively slow process, so caching plugins store fully built pages on the server’s hard drive and deliver them on request. These pages are automatically rebuilt each time the database changes, usually when pages are added or edited.
  • Web server caching. Also known as a “caching HTTP reverse proxy”, these servers sit in front of the web server, caching entire pages as they are sent to browsers. Repeated requests are handled by the proxy, without involving the web server at all. Webdancers’ hosting company uses a service called Varnish for this task.
  • Content Delivery Network (CDN). CDNs store copies of web page data in a distributed network of computers spread around the world. Data are delivered from whichever server is physically closest to browser requesting it. Special configuration is needed on the web server to coordinate the transfer of files to the CDN.

What’s the cache?

In the olden days before the internet, we interacted only with the computer sitting in front of us and possibly others within the building. Now our information could be coming from anywhere in the world. Without caching, the time it takes to travel these distances would be much longer. In exchange for this higher speed, we now have to deal with a little more complexity and occasionally clear the throat of the browser cache.

Any questions? Use the comment form below.

One Comment

Leave a Reply to Solowayne Cancel reply

Your email address will not be published. Required fields are marked *