Logo

What is Cache and When Should It Be Cleared?

When using applications (or apps), we often find the term “cache”. Sometimes, cache has a large size so that is considered as a file that takes up space. This certainly makes users think it’s better to delete it. But actually, cache is useful for speeding up data access.

What is Cache?

Cache is a temporary storage that allow apps (or users) to access previously accessed data faster. Generally, cache is used to store data that is frequently accessed by apps. Instead of retrieving all required data directly from a source everytime an app needs it, such as a server, file, or database, the app can access the data from its cache first. The main purpose of cache is efficiency, saving time and cost.

Imagine our fridge at home as a place to store food supplies. When we need food, we first buy from the supermarket according to our needs and then store it in the fridge at home. When we want to eat, we can simply take the food from the fridge without having to go to the supermarket beforehand. This saves time and cost. We will only go to the supermarket again if the food stock is almost empty or no longer safe for consumption. In this analogy, the fridge acts as a cache.

One of the uses of cache is in browsers. When opening a site for the first time, the browser will access all the data from the server and then filter the data that should be stored in the cache. When accessing the site again, the browser will first check the required data from the cache, whether the required data is still valid or not. If it’s valid, the browser will access the data from the cache and then access the remaining data from the server. This saves a lot of time and bandwidth.

When Should Cache Be Cleared?

Although cache is very useful, there are several conditions that is considered better to clear the cache, such as:

  1. The stored data is outdated.
  2. The data is no longer frequently accessed.
  3. The data takes up too much storage space.

With the deletion of cache, the app will retrieve the latest data directly from the source. This requires time to rebuild the cache. But, the data stored in the cache will be the latest version. This is why some app issues can be resolved after clearing the cache.