Grokking Node.js
0% completed
Implementing Caching with Redis
The first request for product 1 took 2.007 seconds. The second request for the same product, sent right after it, took a few milliseconds and returned the same data. Nothing about the product changed between the two requests: the server simply kept the first answer and reused it. Keeping a copy of data in a place that is faster to read than the original is called caching, and the copy is called a cache.
Why a cache helps, and what it costs
Reading from a database means a network round trip (a request to another machine and its reply), a query, and often a read from disk
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%