What is Web context caching?

7

It is often said, "Oh, this gets stored in cache ..."

Where does the browser store your cache , is there a limit size and has some relation to Local Storage     

asked by anonymous 02.03.2017 / 15:33

1 answer

3

LocalStorage can be used to cache your site in a way that you control, but it is not your primary function.

The data placed in the cache should be considered temporary and nothing guarantees that it will be present at some point. In theory, LocalStorage should be used for "permanent" data.

The cache is a mechanism that allows you to access some data more quickly because it is in a closer environment or that offers better performance or because you do not need to do something that has been done before.

In the case of the web it is used by the browser to keep everything that was once loaded and not need to search again on another machine, which is an operation that generates traffic and responds more slowly, after all networks like the internet are farther away and are usually slower than their own machine. You do not have to ask for something that has already been asked for again.

So it is a repository of files requested by the browser, usually arranged in one or more folders with all these files. Picking up what's there on the disk tends to be faster than ordering it over the internet. Usually what is being used at that time stays in memory to be even faster, since memory is faster than the disk.

It is common for the browser to ask if a particular file on the server has a newer version than the one stored in the cache in order to update it. It is also common that this query is only made after its validity expires. When the validity is not well administered there are some problems frequently reported here and elsewhere saying that a page has changed but the browser still carries the old one.

The cache size limit can exist if the browser wants, this is a control of it. It can also erase what is there long after it reaches a certain consumption. It is common for browsers to set this limit.

At least this is the most common cache when talking about web. There are server caches, but I guess that's not the focus of the question.

    
02.03.2017 / 15:49