title: Rails caching a paginated collection
body: <p>Just doing some research on the best way to cache a paginated collection of items. Currently using jbuilder to output JSON and have been playing with various cache_key options.</p>
  
  <p>The best example I've seen is by using the latest record's updated_at plus the amount of items in the collection.</p>
  
  <pre><code>def cache_key
        pluck("COUNT(*)", "MAX(updated_at)").flatten.map(&amp;:to_i).join("-")
  end
  </code></pre>
  
  <p>defined here: <a href="https://gist.github.com/aaronjensen/6062912">https://gist.github.com/aaronjensen/6062912</a></p>
  
  <p>However this won't work for paginated items, where I always have 10 items in my collection.</p>
  
  <p>Are there any workarounds for this?</p>