What Caching is ?

Caching is a technique that stores a copy of a given resource and serves it back when requested.

In the web world we can make a first distinction between server side cache and client side cache.

Server Side Cache

As we know when we make a request to the server, it processes various operations: functions (objects) and requests to the database. Many of these can be cached on the server, thus speeding up the output response.

There are several extensions to set up cache server like memcached, php opcache, redis but simplifying the concept an example could be related of a sum function:

function mysum(){
$z = $x + $y;
return $z;}

Instead of running this function as is every time we can modify this so that in addition to the result it creates a file with the result and we can cache this file. So if this file with the result exists we include it if it doesn’t exist we execute the function that returns the result and creates the file.

If we consider much more complex operations than a simple sum, this technique is a great advantage to optimize server responses.

In this way we can be more selective in choosing what to cache.

Instead of caching an entire file server, we can cache parts of a file.

Client Side Cache

Client-side caching is used for storing data files that could be useful to the user on their personal computer. Though there are various types of client-side caching, browser cache is the one we’ll explore below.

Browser Cache

It’s nothing more than a place on your hard disk where the browser keeps things it downloaded once in case they’re needed again.

When you visit a website, your browser takes pieces of the page and stores them on your computer’s hard drive. Some of the assets your browser will store are: images, logos, pictures, backgrounds, html, css, Javascript.

It’s faster to get something from your hard disk than it is to get it from the internet.

As a cache browser we also have two main distinctions here. One is http caching and the other is the html5 cache manifest.

Having made this brief and simple introduction to caching, I wish to introduce an even simpler insight:
why not make these resources in the browser cache sharable and make the browser cache interoperable ?

Interoperable Browser Cache

We are often so absorbed by the complexity that the obvious and the simplicity, sometime, escape us.

A simple insight into a different browser cache management policy could reduce CO2 emissions, save web users data consumption and increase web page loading speeds.

This new cache management policy for web browsers will simply take a resource from a website by caching it once and will share it with all other different websites that require it without needing to be cached again by all other websites.

Naturally not for all the resources but only for those that the web considers public and common.

How many web content, with different DNS from each other, use, for example, the same resource e.g. jQuery? Why is it necessary to download this same resource from every website or from a CDN every time ?

If this were available in a permanent cache of browser, there would be no need to download it every time, so it is always the same resource.

If a previous or more updated version is needed, this permanent cache could be updated with multiple versions. In this way a common resource in this interoperable browser cache, downloaded from the website exampledomain1.com, will be reusable for the website exampledomain2.com, etc, without needing to be downloaded again in cache.

Let’s think of how many CMSs (Content Management System) like WordPress, Magento, Joomla, Drupal use e.g. the jQuery framework.

And not only CMSs but also CRMs (Content Relationship Management) like e.g. SalesForce or E-Learning Platform, etc, etc. Today almost all the software have a web version accessible from a web browser.

Let’s think of how many resources like JavaScript framewoks, Css framework, fonts, analytic could be considered common and public and be included in this new and particular interoperable browser cache.

This new sustainable browser cache management policy could, by making PWAs (Progressive Web Apps) faster, leading developers to prefer the latter over Native Apps with the advantage of greater web diffusion for low cost, low-end, mobile devices.