Search code examples
ruby-on-railsruby-on-rails-4rubygemsdallimemcachier

require 'dalli' returns false in the console, although it is in the gemfile


Following https://devcenter.heroku.com/articles/memcachier#ruby

I added memcachier and dalli gems, and did a bundle install

then I ran the console

and I typed

require 'dalli'

and it returns false

and I can't tell why, it also does this in a staging and production environment


Solution

  • If you want to test those in irb

    Try:

    gem install dalli
    gem install memcachier
    

    And after that require them:

    require 'dalli'
    require 'memcachier'
    

    If you want to test in your app console, you don't need to require them just do that:

    cache = Dalli::Client.new
    cache.set("foo", "bar")