Rails 4.0 expire_fragment/cache expiration not working

I believe the issue is that when you cache the fragment in your view, a cache digest is being added to the cache key (views/all_available_releases/41cb0a928326986f35f41c52bb3d8352), but expire_fragment is not using the digest (views/all_available_releases).

If you add skip_digest: true to the cache call in the view it should prevent the digest from being used.

<% cache "all_available_releases", skip_digest: true do %>
 <% @releases.each do |release| %>
  <% cache(release) do %>
   <html code with>
   <%ruby code @release.name blah blah blah%>
  <%end%>
 <%end%>
<%end%>

Cache digests are only intended to be used with automatic cache expiration. If you need to manually expire cache keys then you can’t use cache digests.

Leave a Comment