I just figured this out today. I wrote it up here (http://
www.arailsdemo.com/posts/17). Basically, you have to configure Dalli
to use the Heroku memcache server. Simply change your config to:

# production.rb
  config.action_controller.perform_caching = true
  config.cache_store = :dalli_store, ENV['MEMCACHE_SERVERS']


(BTW: I was also having problems installing memcached-northscale.  I
think this had to do with using ruby 1.9.2. If you're using RVM just
switch to ruby 1.8.7.)

Good luck.



On Oct 18, 6:40 am, Joost Schuur <jsch...@jschuur.com> wrote:
> I've been experimenting with memcached and read good things about the
> dalli gem, so I thought I'd try it out on Heroku. I can't seem to get
> it to work and m not getting back any obvious errors either.
>
> My production.rb defines:
>
> config.action_controller.perform_caching = true
> config.cache_store = :dalli_store
>
> ...and in my Gemfile:
>
> gem 'dalli'
>
> However, based on the logs, it's not reading from the cache. Upon
> refreshing the page in question twice (to make sure the cache was
> written the first time around), I still get this:
>
> Exist fragment? views/front_sidebar (506.9ms)
> Write fragment views/front_sidebar (508.3ms)
>
> Likewise, from the heroku console for the app in question:>> 
> Rails.cache.write('hello', 'world')
> => false
> >> Rails.cache.read('hello')
>
> => nil
>
> I've restarted the heroku server during my tests too, and have
> confirmed that I have the add-on installed (the app name is
> tvgridthing-stage, if a Heroku rep would like to take a look).
>
> I don't know what other debug tools there are for dalli. I tried
> checking the stats, but the instructions 
> athttp://docs.heroku.com/memcache#getting-stats-on-usage
> obviously don't apply to dalli, which doesn't seem to have a stats
> command.
>
> Locally on my Mac, things seem to work just fine, based on the
> presence of 'Read fragment views/front_sidebar (0.0ms)' in the logs.
>
> I'm running Rails 3.0.1 and dalli 0.10.0 FWIW.
>
> Then I thought I'd try the standard memcached instead, so I added this
> to my Gemfile
>
> group :production do
>   gem "memcache-client"
>   gem 'memcached-northscale', :require => 'memcached'
> end
>
> ...and in production.rb:
> config.cache_store = :mem_cache_store, Memcached::Rails.new
>
> Unfortunately, despite the :production group, when I went to do a
> bundle install locally first, it tries to compile native extensions
> under Mac OS X for memcached-northscale, and I get a compile error
> that's been discussed here too:
>
> http://osdir.com/ml/ruby-talk/2010-02/msg01693.html
>
> Should I be able to tell bundle what environment to run under, so that
> it'll ignore that on development and thus bypass any attempt to
> install memcached-norrthscale?

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to