title: How to Low-Level Caching ? Cache key
body: <p>I want to implement low level cache on my application but I'm having some troubles following the documentation. This is what they have as example:</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
    def competing_price
      Rails.cache.fetch("#{cache_key}/competing_price", expires_in: 12.hours) do
        Competitor::API.find_price(id)
      end
    end
  end
  </code></pre>
  
  <p>My questions are:</p>
  
  <ul>
  <li><p>How am I suppose to get that variable <em>cache_key</em>? Should be given somehow via rails cache or should I have my pre-builded key?</p></li>
  <li><p>I'm not sure if I clearly understood how this works, confirm if this logic is correct: I set this for example on my controller to generate a ton of variables. And then every time a variable is requested (from view for example), the controller instead of recalculating it every time (long query) will retrieve the pre-made query in case the key haven't changed. If the key has changed it will recalculate again all variables inside the cache block.</p></li>
  </ul>