n8 / multi_fetch_fragments

Multi-fetch Fragments makes rendering and caching a collection of template partials easier and faster.
http://ninjasandrobots.com/rails-faster-partial-rendering-and-caching
MIT License
539 stars 63 forks source link

cache_options might not be working in Rails 4 #22

Closed robotmay closed 11 years ago

robotmay commented 11 years ago

I have a Rails 4 app and I'm using the following render call:

= render @photographs, cache: true, cache_options: { expires_in: 10.minutes }

However the cache expiry option never makes it to the write call, as far as I can tell (notice how the other cache reads/writes have the expiry option noted in the logs):

Cache write: views/photographs/2007-20130514075157325004000/86a3d50c854dde8d1587667ed0367762
Cache write: views/photographs/2006-20130514074910243807000/86a3d50c854dde8d1587667ed0367762
Cache write: views/photographs/2005-20130514074815238693000/86a3d50c854dde8d1587667ed0367762
Cache write: views/photographs/2004-20130514074438247143000/86a3d50c854dde8d1587667ed0367762
Cache write: views/photographs/2003-20130514074433630211000/86a3d50c854dde8d1587667ed0367762
...
  Rendered photographs/_photograph.html.slim (143.5ms)
  Rendered photographs/index.html.slim within layouts/application (593.7ms)
Cache read: views/nav/explore/photographs/b1a68cde36235e0fcb82a2496d24f1d2 ({:expires_in=>600 seconds})
Read fragment views/nav/explore/photographs/b1a68cde36235e0fcb82a2496d24f1d2 (0.5ms)
Cache write: views/nav/explore/photographs/b1a68cde36235e0fcb82a2496d24f1d2 ({:expires_in=>600 seconds})

I've tried looking myself but I've not found the cause yet. Any ideas?