Isa Kniess 10 May, 2023
There is always a bottleneck. What is a Cache?

Anytime you want to do something with a computer or on the internet, there is going to be a place where it slows down.  In the early days of dial-up, the time it took to move data from the Internet to your computer was a huge bottleneck.

The developers looked to a simple technology to “fix” the issue: caching.

Caching is the process of storing a piece of data that has already been fetched or computed, for reuse later.  A cache can also create or denote a starting place to continue a process, without having to redo the entire process.

The farther away data is from where you need it, the longer it takes to get and use it.  Consider wanting to display an image from the Internet.  First, you have to download it to your disk. Then it has to be loaded from disk to memory, and then it has to be sent to the CPU to turn the encoded image into the pixels you see on your screen.

If you have to go through that entire process every time you look at that particular image, there is a great deal of repeated costs (time).  We want to reduce that for the end user.

The first thing we do is that we cache that image on our local disk.  When we want to display that image we just load it from the local disk.  There is no need to download it again.  If that image was recently used on a page, it might already be cached in memory, so there is no need to download it again.

This caching process makes the first time you visit a website feel slower than the next time you visit that page.  

In addition, as good web developers we attempt to standardize supporting data. Information, like images and libraries are shared across all the pages of a website in order to reduce the number of different files that have to be downloaded as you navigate the website. Contact our account specialists at Twel if you would like us to evaluate your site.

There is an issue that happens if you use a cache.  How do you know that what you have in your computer’s memory or on disk locally is the same as what is currently being served by your website?

The answer is in HTTP.  One of the many headers that are sent is how long the local cache can hold onto a downloaded file without checking to see if it has expired.  When your local browser determines that it is time to check, it sends a request not to download the file, but to see if the file has changed since it was downloaded.

If the file has changed, the file is downloaded again and the new content is displayed.

Besides local caching, the remote web server is also capable of caching and there are entire systems of caching designed to do nothing but speed up access to your website.


What are the downsides to using cache?

As a user, have you ever opened a page and it doesn’t look right?  At that point somebody in the support staff will tell you to “clear your cache” or “force reload” the page. A forced reload tells your web browser to reload the current page, ignoring anything that is in cache.  Your browser will often have a reload button.  Clicking this while holding down the shift key will usually do that forced reload.  

Clearing the local browser cache is normally done through the browser settings.


How do I clear my browser's cache?

This is slightly different depending on your browser. This tutorial website may help, as it shows methods of cache clearing for many browsers. 

In Chrome, for example, follow these instructions:

1. Go to Settings:


2. Click on Privacy and Security: 

Privacy and Security

3. Click on Clear browsing data: 

Clear browsing data

4. Chose the data you want to clean; in this case cached images and files: 

Chose the data you want to clean

5. Click on Clear data

Often, free browser extensions are available, making this process even more accessible.

The other issue is not as big of a problem as it used to be.  The space taken on disk to store cached files can grow large...However, most browsers allow you to set the maximum size the disk cache can be.  In order to cache data across restarts of the browser and reboot your computer, the cached data is normally stored on disk. If you have free disk space, don’t worry about caching locally.  It isn’t worth the effort to manually manage your cached files.

Stay tuned for part II of this article! If you ever have questions about managing caching for your website, please feel free to reach out to your Twel Representative for assistance.