Cache me outside

Timo Makhlay
4 min readFeb 6, 2019

--

Every second and megabyte matter, and consequentially theres a lot of ways to optimize your online browsing experience. One very commonly used method is Caching. Caching is a persistence that optimizes the load time of a webpage and optimizing the amount of memory it uses.

What is caching?

Although the name is cool and makes us think that we’re receiving big pay check and placing it in our bank accounts, it’s completely different from that.

To explain what caching is, I’m going to focus on Web Caching. When you load a website, the website data (such as images, videos and html documents) is saved. Once you reaload the website it doesn’t call to the database to get that data again. It just pulls the data back together from memory.

Trading off capacity for speed, a cache typically stores a subset of data transiently, in contrast to databases whose data is usually complete and durable.

Client Side Caching

Client Side Caching is often called Browser Caching, although Client Side Caching is a slightly broader term. How it works:

Once the browser has requested the data from the server, it stores it into a folder created by the browser. The next time you open the webpage, it won’t make a call to the server for the data, it will pull it from the Browser Cache folder.

This is a simplistic measure that can be used to reduce the latency involved with requesting web resources from a website.

Server Side Caching

Server side caching is a similar concept but a little more complex.

Once the user has made a request to a website, it’s data is stored on a server. Next time the user makes a request, it just gets back the saved data from the server saving the time by not having to pull the data from the database.

These caches are implemented by site administrators and act as intermediaries between the browser and origin servers. They are also commonly based on HTTP cache directives.

Remote Caching

Remote Caching is similar to Server Side Caching but it can also run an application to serialize and deserialize the data. The difference is that you’re in control of the Remote server and it is not operated by someone else.

The web content is retrieved typically by means of application code or use of an application framework that can leverage the In-Memory data store.

Server-Side vs Remote vs Client Side

The main difference is that the website’s data is saved locally in Client Side Caching, while in Server Side Cache can be distributed to all the users and in the Remote, the data also gets processed.

Most well engineered websites or applications will use both Server Side and and Client Side.

Why caching?

Caching web content helps improve upon the responsiveness of your websites by reducing the load on backend resources and network congestion. — AWS

Downside

If the website you’re trying to access got updated, you might not see the update until you clear your cache. This probably happened to you before, especially if you’re a Web Developer and you’re trying to update your website’s design. The solution is simple if the cache is stored in your Client Side.

This is true with client side caching and might return an error on the Server Side Cache if it doesn’t handle the situation properly.

If you you’re using Remote Caching, it can handle that error and clear the cache for you and load a fresh request for you.

Sources:

--

--