title: Rails: Skip controller if cache fragment exist (with cache_key)
body: <p>I have been using cache for a long time and recently discovered that my fragment caching doesn't stop my controller from executing the code, as it always has been. I have boiled the problem down to have to do with the cache_key that seems to be a new feature?</p>
  
  <p>This is my previous solution that no longer works as expected. </p>
  
  <p>Product#Show-view:</p>
  
  <pre><code>cache('product-' + @product.id.to_s)  do
  # View stuff
  end
  </code></pre>
  
  <p>Product#Show-controller:</p>
  
  <pre><code>unless fragment_exist?('product-19834') # ID obviously dynamically loaded
  # Perform slow calculations
  end
  </code></pre>
  
  <p>The <strong>caching works fine</strong>. It writes and reads the fragment, but it <strong>still executes the controller</strong> (which is the whole reason I want to use caching). This boils down to the fragment has an added unique id so the fragment created is something like:</p>
  
  <pre><code>views/product-19834/b05c4ed1bdb428f73b2c73203769b40f
  </code></pre>
  
  <p>So when I check if the fragment_exist I am not checking for the right string (since I am checking for 'views/product-19834'). I have also tried to use: </p>
  
  <pre><code>fragment_exist?("product-#{@product.id}/#{@product.cache_key}")
  </code></pre>
  
  <p>but it checks with a different cache_key than is actually created.</p>
  
  <p>I would rather use this solution than controller-caching or gems like interlock. </p>
  
  <p>My question is:
  - How do I, in the controller, check if a fragment exist for a specific view considering this cache key?</p>