Cache

Definition
Store the result of a heavy request in order to serve it immediately in the following requests.
Caching architecture diagram

How does it work?

When a request for data is made, and it is computationally expensive to retrieve it, first the cache is checked for the result. If it's not already there, the result is calculated, placed in the cache, and returned.

Examples

  • Caching web pages

When should you use it?

  • When calculating a resource takes too long

Problems

  • First hit is slow
  • Cache invalidation

Links