Getting Heroku, memcached and Rails 3 working

Mon Sep 13 02:41:29 -0700 2010

The docs for Heroku and memecached do not cover Rails 3. So here is the short version:

In your Gemfile:

group :production do
  gem "memcache-client"
  gem 'memcached-northscale', :require => 'memcached'
end

In your environment.rb:

config.cache_store = :mem_cache_store, Memcached::Rails.new

Told you it was short.

Oh, and remember to install the memcached add on to your app:

heroku addons:add memcache:5mb

Told you it was short.

blogLater

Mikel

  1. Ramin Says:

    I actually had to define the config.cache_store = :mem_cache_store, Memcached::Rails.new inside my config/environments/production.rb to get this to work.

  2. Ramin Says:

    I actually had to define the config.cache_store = :mem_cache_store, Memcached::Rails.new inside my config/environments/production.rb to get this to work.

  3. aokudsrm Says:

    Helpful note: memcached-northscale doesn’t work with Ruby 1.9.2. And since Rails3 is unstable on Ruby 1.9.1, you’re probably going to have to go with 1.8.7

  4. Joost Schuur Says:

    @W. Andrew: I couldn’t get dalli to work on Heroku without explicitly specifying the memcached server environment variable in the config line like this:

    config.cache_store = :dalli_store, ENV[‘MEMCACHE_SERVERS’]

    Props go to http://arailsdemo.com for pointing that out to me after some frustrating and futile debugging.

  5. Kate Says:

    Helpful note: memcached-northscale doesn’t work with Ruby 1.9.2. And since Rails3 is unstable on Ruby 1.9.1, you’re probably going to have to go with 1.8.7

  6. jc Says:

    Agreed, memcached-northscale is still busted in 1.9.2. Thanks to W. Andrew for the dalli suggestion. That worked as a great alternative.

  7. W. Andrew Loe III Says:

    Better yet, use dalli. It is considerably easier to hook for monitor and fast enough for all but the most demanding apps (uses the binary protocol but implemented entirely in Ruby).

    http://github.com/mperham/dalli

    1. Gemfile
      gem ‘dalli’
    1. environments/production.rb
      config.cache_store = :dalli_store
  8. Bank IFSC code Says:

    This blog is providing beautiful news about the Liberian Educational Sector. It is nice to know about it this is useful information. And such blogs makes us familiar with the whole world.

  9. Bank IFSC code Says:

    This blog is providing beautiful news about the Liberian Educational Sector. It is nice to know about it this is useful information. And such blogs makes us familiar with the whole world.

  10. Bank IFSC code Says:

    This blog is providing beautiful news about the Liberian Educational Sector.

  11. fdsg3tgfv Says:

    Helpful note: memcached-northscale doesn’t work with Ruby 1.9.2.why am i always tired And since Rails3 is unstable on Ruby 1.9.1, you’re probably going to have to go with 1.8.7 Fatigue Symptoms

  12. project management tools Says:

    Wonderful web site. Plenty of helpful information here. I am sending it to a few friends ans also sharing in delicious.

  13. skin moles Says:

    I’m impressed. You’re truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. I’m saving this for future use.

  14. skin moles Says:

    I’m impressed. You’re truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. I’m saving this for future use.

  15. sameer thapar Says:

    Well for Php ruby rails is of great use and it is mostly preferable to use this code.

  16. How to Get Scholarships Says:

    Agreed, memcached-northscale is still busted in 1.9.2. Thanks to How to Get Scholarships W. Andrew for the dalli suggestion. That worked as a great alternative.

  17. Quirky gifts distributor Says:

    This is really a great post. I have been wasting my time among different blogs, but thanks to writer who has solved my problem here.

  18. Avioes a Venda Says:

    And since Rails3 is unstable on Ruby 1.9.1, you’re probably going to have to go with 1.8.7, thanks for sharing

  19. bestowadeel Says:

    Its a wonderful post and also informative. I would like to thank you for sharing this information. Thanks for sharing Security Companies Slough | Security Companies St Albans | Security Companies London | Security Companies Crawley | Security Companies St Davids | Car parts Birmingham

  20. Notary Public Kettering Says:

    I always love to make addition to my knowledge and this one really fulfils my need. I just want to comment on the post. Its too loud. More power to your blog.

Leave a Reply