What is caching?
Caching stores frequently accessed or expensive-to-compute data in a faster-access location so future requests can be served more quickly. Node.js applications commonly use in-memory caches or distributed caches such as Redis. A good caching strategy must consider expiration, invalidation, consistency, memory usage, and cache stampede behavior.
Key Takeaways
- Caching improves access latency and reduces repeated work.
- Cache invalidation is a major design concern.
- Distributed caches can share cached data across application instances.
Knowledge Check
What is a primary benefit of caching?