Rendering a page in Rails isn't a simple process. It usually consists of several database queries that render various partials and convert HAML to HTML. Repeating this entire process for each page load is wasteful. In this recipe, you will learn how to cache your views so that you only have to render them once. You'll also learn how to use key-based cache expiration to ensure that you're always serving the latest content.
In this recipe, we'll use the Blogger application as an example to implement view caching. This time, we will optimize
posts#show using caching to make viewing a post as fast as possible.
Make sure that caching is enabled in