Reputation: 695
I am trying to cache an expensive fragment of my view. Other parts of the application have working caching. This is the view (in haml)
@users.each do
- cache user, expires_in: 60*60*8 do
%tr{id: "user_id_#{user.id}"}
%td= user.name
# lots of other simple calcs
-cache "user_#{user.id}_score", expires_in: 1.week do
- score = #expensive calculation
%td= score
However, when I look at production, I cannot find the cache
Rails.cache.read('user_215_score')
What am I doing wrong?
Upvotes: 1
Views: 150
Reputation: 695
Forgot to add 'views'
Rails.cache.read 'views/user_215_retention'
Returned the expected result
Upvotes: 1