title: Memcache basic use in rails 3
body: <p>So I'm trying to learn how to use memcache. I installed it in my system. I'm running it. I installed the dalli gem. </p>
  
  <p>All that seems to be just fine.</p>
  
  <p>Lets say I'd like to cache my users table.</p>
  
  <p>I put this in my User.rb file:</p>
  
  <pre><code>  def self.all_cached
      Rails.cache.fetch('User.all') { all }
    end
  </code></pre>
  
  <p>Then in my controller file, I used to have:</p>
  
  <pre><code>@users = User.where(:group_id =&gt; current_user.group_id)
  </code></pre>
  
  <p>So now I'd like to have something like:</p>
  
  <pre><code>@users = User.all_cached.where(:group_id =&gt; current_user.group_id)
  </code></pre>
  
  <p>I'm getting a no method error for where... Any ideas for how I should accomplish this?</p>