title: Rails Action Caching for user specific records
body: <p>I am a rails newbie trying to implement caching for my app.
  I installed memcached and configured it in my development.rb as follows:</p>
  
  <pre><code>config.action_controller.perform_caching             = true
  config.cache_store = :mem_cache_store
  </code></pre>
  
  <p>I have a controller ProductsController that shows user specific products when they are logged in.</p>
  
  <pre><code>class ProductsController &lt; ApplicationController
    caches_action :index, :layout =&gt; false
    before_filter :require_user
  
    def index
      @user.products              
    end
  end
  
  The route for index action is: /products
  </code></pre>
  
  <p>The problem is that when I login as </p>
  
  <p>1) User A for the first time, rails hits my controller and caches the products action.</p>
  
  <p>2) I logout and login as User B, it still logs me in as User A and shows products for User A and not User B.
  It doesn't even hit my controller.</p>
  
  <p>The key probably is the route, in my memcached console I see that it's fetching based on the same key.</p>
  
  <pre><code>20 get views/localhost:3000/products
  20 sending key views/localhost:3000/products
  </code></pre>
  
  <p>Is action caching not what I should use? How would I cache and display user specific products? </p>
  
  <p>Thanks for your help.</p>