Iteration C5: Caching of Partial Results
If everything goes as planned, this page will definitely be a high-traffic area for the site. To respond to requests for this page, we’d need to fetch every product from the database and render each one. We can do better than that. After all, the catalog doesn’t change that often, so there’s no need to start from scratch on each request.
So we can see what we’re doing, we’re first going to modify the configuration for the development environment to turn on caching. To make this easy, Rails provides a handy command to toggle caching on and off in the development environment:
| | depot> bin/rails dev:cache |
Note that this command will cause your server to automatically restart.
Next we need ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access