A cache is a temporary place that stores contents in order to be served faster when they are needed. Considering that we already have a permanent place on disk to store our web contents (templates, codes, and database tables), a cache sounds like a duplicate storage.
That is exactly what they are. They are duplicates and we need them because, in return for consuming extra space to store the same data, they provide a very fast response to some requests. So this is a very good trade-off between storage and performance.
To give you an example of how good this deal can be, consider the following image. On the left-hand side, we have a usual client/server request/response model, and let's say that the response latency is two seconds and there are only 100 users who hit the same content per hour.
On the right-hand side, however, we have a cache layer that sits between the client and server. What it basically does is it receives the same request and passes it to the server. The...