Caches and Cookie blog banner in web development

“Cache” and “Cookies”

Ever wondered what they are and what they do? Or perhaps you know what they are but are unsure how they are different. In this blog, we will be covering what the Cookies and Caches are and what’s the difference. Let us begin!

What are they?

Let us begin by diving into what the 2 terms means. Funny enough, both terms works and acts similarly but for different purposes. Both Cache and Cookies stores data, typically in small sizes, into your devices in order to improve user’s experience. They are most often downloaded into your device upon the first visit to the site. The better way to understand is to know what each term does in-depth to know the differences.

  • Cookies

    Cookies refers to a file that is stored in your device after your first visit to the site and would commonly contain the site’s name. It stores information based on your browsing history. In certain cases, the file would also be used to tailor pop-ups based on the number of times you’ve visited the site and which pages.

    You have probably seen pop up notifications about these “Cookies” on many sites, constantly asking for permissions. Often the sites asks for permission due to laws and regulation in countries. However, you can still browse the sites’ contents regardless of whether you consent to the cookies. The followings are:

cookies in web development

A Cookie Consent popup example from SendGrid

y8 web development

An example of a cookie consent banner taken from y8.com

  • Cache

    Have you ever noticed the difference in loading speed of a page or site between your first visit and multiple visits? This is all thanks to “Cache”. You see, Cache stores backups or copies of images, videos and elements on your devices. This helps your device to save time re-loading every single elements when you visit the page. Thus, it results in pages loading faster than the first time you visited the page.

    However, cache does not always update its contents successfully. Sometimes some old files may not get override during an update or certain changes might not be saved. This may cause the site to not display correctly. Often such issues can easily be solved where user deletes or clear the cache files stored in their devices. It would cause the device to re-download the cache files, this time with the latest versions.

A Scenario

For visualization purposes, let’s put on our imagination cap. Imagine yourself browsing an online store, for example, a clothing shop.

In this scenario, when you visit the shop and you browse around the products, it take notes of what you are looking at. Whether you end up buying or not ultimately, it does not matter. At the end of your browsing when you leave and visit other sites, you’ll notice ads. Ads about the products or related products from both same and other sites will start appearing. This is what Cookies does, it stores your preferences and browsing history to tailor things for you.

Now imagine the first time you visited that site, it took a few minute to load all the images of the shoes successfully. However, few days later when you re-visited the site to browse more, you’ll notice it took less than a minute for the images to load. This is because when you first visited, a small part of all the images were stored in your device. This makes the resource loading from your 2nd visit onward to be faster and the only delays would be from new resources added. For example, new products that was added recently. This is exactly what cache does.

Hopefully this example helps you visualize and understand it clearer.

Side by side comparisons

Now that you know what each do, let us compare the two side by side to know some other small differences.

  • How they work

    A brief recap, both the files are stored into the device upon first visits. Cookie stores files which records browsing and in certain cases, tailor the site while Cache makes the site load faster.

  • Stored Contents

    Cookies stores information such as site name, number of times user visited and preferences on the site. Cache stores resource files and elements such as videos, pictures, audio etc.

  • Permission and Consent

    Most, if not all, sites will have a pop up to ask for permission about Cookies as tailoring may require the preference of users to be used. This is due to the Data Protection Laws implemented. The most common or well known law implemented is the “General Data Protection Regulation” (GDPR) in the EU region. Cache on the other hand does not require permission usually however some sites may go out of their way to inform the users.

  • Duration of Storage

    Cookies will often expiry after a period of time. Cache on the other hand would remain stored in the device until the user clears it manually.

How do I clear Cache and/or Cookies?

Now that we know what they are, what they do and how it works, you might be thinking of clearing them. But how? The answers generally differs between browsers and devices used. For example, on mobile devices, you may clear the cache from your browser’s settings or going to your app’s setting. On desktop on the other hand, you can visit your browser’s settings. And depending on which browser you are using, there are different ways of handling it. However, generally the Cookies and Cache can be found under the “Privacy and Security” tab.

For example, here are some screenshots of where the Cookie & Cache settings are:

firefox web development

On a Firefox Developer Edition browser.

chrome web development

In a Google Chrome browser.

cache in web development

And a Safari browser.

As seen in s pattern, simply head to your browsers’ preference settings and you’ll find it. It’s usually tucked under the “Privacy and Security” tab and has the options to clear or manage them.

In Conclusion,

For the few of you who were might have been worried about being monitored, Cookies and Cache are both harmless. We also suggest clearing your browsing cache occasionally to if you are having trouble loading pages. Regardless if you dropped by to learn more about Cookie and cache or how to clear them, we hope our blog helped. For more useful or interesting blogs, check out our other entries! Or perhaps check out our services to find out what we offer.