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

611 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

It depends on the circumstance but ‘cache’ is a general term used in a couple of areas. CPUs have a cache memory which makes the already fast process of retrieving information from memory even *faster*. Higher quality chips tend to have more of it. A cache in a database is a collection previously run queries. Say user A queries a database and user B comes along and queries a subset of that. We call that a ‘cache hit’, since the system already got the data for user A; no need to go back to the database for the same information. Database lookups are orders of magnitude slower than a cache hit. There are some databases, like redis, whose essential function is to get as much useful data as it can into cache so it can process millions of transactions.

Caches aren’t perfect, sometimes an update will happen to data after data has been put in cache, but before the cache expires. You may get old data out of the system. Some version of that is the reason for most cache problems, the cache you have access to is incomplete or old. If you clear the cache, you force the system to get all new data, even though it is a little slower. That is why it seems like a God fix, it is like resetting everything to zero and starting over.

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