What is cache in the context of the Web?

Asked

Viewed 220 times

8

It’s often said, "Oh, that’s stored in cache..."

Where the browser stores your cache, there is a limit size and has some relationship with the Local Storage`?

1 answer

5


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

The data placed in the cache should be considered temporary and nothing guarantees that they 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 faster because it is in a closer medium, or it 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 all that has already been loaded once 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 further away and are usually slower than your own machine. There’s no need to ask again for something that’s already been asked for.

So it is a repository of files requested by the browser, usually arranged in one or more folders with all these files. Getting what’s on that 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 disk.

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

The cache size limit may exist if the browser wishes, this is a control of it. It can also go on erasing what has been there for a long time after it reaches a certain consumption. It is common for browsers to allow setting this limit.

At least this is the most common cache when talking about the web. There are server caches, but I don’t think that’s the focus of the question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.