Caching strategies
After a short break, Alex returns with some more questions. He has understood the principles behind ElastiCache, and he’s now considering how to use it in the TrendyCorp projects.
Alex: It’s evident that ElastiCache is a technology for developers. Are there any common approaches we should compile to tell our developer team?
Berta: There are a couple of basic design possibilities, or I should say caching strategies. Obviously, you can build your own based on them. In the end, it’s your code. But the key principles remain the same.
The first one is called lazy loading:
Figure 14.7 – Lazy loading caching strategy
Berta: In this strategy, the cache is initially empty. That means that when the data is requested for the first time, the cache won’t have it. It will be a cache miss.
Now, the application has to read the data...