title: Low level caching for collection
body: <p>I want to use Redis to do some low level caching in my Rails app.
  In a controller I normally us this to get all books:</p>
  
  <pre><code>class BooksController &lt; ApplicationController
    def index
      @books = Book.order(:title)
    end
  end
  </code></pre>
  
  <p>And the view iterates over this:</p>
  
  <pre><code>&lt;ul&gt;
    - @books.each do |book|
      &lt;li&gt;= "#{book.title} - #{book.author}"&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Now I want the exact same result but then cached. I have Redis setup and running. So should I use a <code>cached_books</code> method in the controller like this:</p>
  
  <pre><code>@books = Book.cached_books.order(:title)
  </code></pre>
  
  <p>And leave the view as it is, or use <code>book.cached_title</code> and <code>book.cached_author</code> in the view and leave the controller as it is?</p>
  
  <p>And how would a <code>cached_books</code> method look like in the <code>Book</code> model?</p>
  
  <pre><code>class Book &lt; ActiveRecord::Base
    ...
  
    def cached_books
      Rails.cache.fetch([self, "books"]) { books.to_a }
    end
  end
  </code></pre>
  
  <p>For simplicity sake I leave out expire strategies for now, but obviously they need to be there.</p>