title: Heroku Memcache issue - Dalli::NetworkError: localhost:11211 is down
body: <p>I have recently upgraded Rails to 3.2.2 and now I seem to be running into Memcache related issues... can anyone help?</p>
  
  <p>My production config:</p>
  
  <pre><code>config.serve_static_assets = true
  config.static_cache_control = "public, max-age=2592000"
  config.assets.digest = true
  config.action_controller.perform_caching = true
  config.cache_store = :dalli_store
  config.action_dispatch.rack_cache = {
   :metastore    =&gt; Dalli::Client.new,
   :entitystore  =&gt; 'file:tmp/cache/rack/body',
   :allow_reload =&gt; false
  }
  </code></pre>
  
  <p>Dalli gem is in the bundle</p>
  
  <pre><code>gem 'dalli'
  </code></pre>
  
  <p>I've added the memcache addon via herokus GUI.</p>
  
  <p>My Procfile is thusly (also have the 'thin' gem installed):</p>
  
  <pre><code>web: bundle exec rails server -p $PORT thin -e $RACK_ENV
  </code></pre>
  
  <p>but I'm getting these errors even when I try to do simple cache maintenance in the console:</p>
  
  <pre><code>Loading production environment (Rails 3.2.2)
  irb(main):001:0&gt; dc = Dalli::Client.new('localhost:11211')
  =&gt; #&lt;Dalli::Client:0x00000007501980 @servers="localhost:11211", @options={}, @ring=nil&gt;
  irb(main):002:0&gt; dc.flush_all
  localhost:11211 failed (count: 0)
  Dalli::NetworkError: localhost:11211 is down:  
      from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/server.rb:47:in `request'
      from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/options.rb:18:in `block in request'
      from /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
      from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/options.rb:17:in `request'
      from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/client.rb:158:in `block in flush'
      from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/client.rb:158:in `map'
      from /app/vendor/bundle/ruby/1.9.1/gems/dalli-2.2.1/lib/dalli/client.rb:158:in `flush'
      from (irb):2
      from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
      from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
      from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:41:in `&lt;top (required)&gt;'
      from script/rails:6:in `require'
      from script/rails:6:in `&lt;main&gt;'
  </code></pre>
  
  <p>And of course, asset serving is also failing:</p>
  
  <pre><code>2012-09-29T02:26:29+00:00 app[web.3]: cache error: No server available
  2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:80:in `block in pre_process'
  2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
  2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in `run'
  2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
  2012-09-29T02:26:29+00:00 app[web.3]: /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/commands/server.rb:70:in `start'
  </code></pre>
  
  <p>Is this a problem with my config ? Is this a Heroku issue?</p>