ElI5 why is the ‘cache’ this all powerful crasher of apps and causer of problems? Why does clearing it fix things?

651 views

ElI5 why is the ‘cache’ this all powerful crasher of apps and causer of problems? Why does clearing it fix things?

In: 101

22 Answers

Anonymous 0 Comments

A browser cache prevents you from downloading something twice unnecessarily. If every page of a website has some common images, CSS, JavaScript or makes some repeated requests for the same data, it would be a waste to redownload it if we thought it was unlikely to change. Having a cache saves bandwidth and makes pages load faster.

However, some data does need to be downloaded regularly and shouldn’t be cached, at least not for long.

Every time the web browser receives something, the server also tells it how long it should cache it for. This way the browser doesn’t need to be smart, the programmers of the server can decide what the right amount of time for the cache is.

However, sometimes (often) they get it wrong and they set a cache time that is too long. Perhaps it should never cache but some junior programmer somewhere forgot to change the default. Unfortunately, even if they notice the problem fairly quickly, your cache trusts what it sees and decides not to redownload this file, which means it never sees the fixed cache time.

This is called cache poisoning.

If this is a JavaScript file, it might mean your browser keeps running an old version of code, which no longer works properly. If it’s a data response, it could mean you keep seeing our of date data. All kinds of things can go wrong at this point.

Clearing the cache is a simple and reliable solution.

You are viewing 1 out of 22 answers, click here to view all answers.