Eli5: What is cached data?

626 views

Eli5: What is cached data?

In: Technology

8 Answers

Anonymous 0 Comments

Imagine you work at the local corner store and one of the services you offer is telling people what the weather forecast is for the day. When your first customer comes in and asks what they weather is you have to go into the office and check the internet. When you get back you tell them that it’s currently 70F, will reach 85F at noon and might rain at 4pm.

Now as other customers come in and ask the same question, you’d waste time going back and checking the forecast for each one as it’s unlikely to change any time soon so you just repeat what you already know: 70F, 85F at noon, rain at 4pm. It may not be exactly right, but it’s close enough.

That’s what caching is, re-using data that may be old or out of date. Caching can help speed up access to data provided that real-time accuracy is not required. In the example above, nobody is really going to care if the current temp is actually 72F instead of the 70F you told them and getting the real data would be slow because you have to have the customer wait while you walk back to the office and load up the current forecast. Just telling them what you saw earlier is quick and easy.

Eventually the cached data gets to be too inaccurate and you have to check the real data again. This is known as the expiry time or time-to-live (TTL). For example, you might decide that you need to look at the forecast again after an hour so you’d say your weather cache has a 1-hour TTL.

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