Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
To get Dalli to use the Heroku memcache server, you need do nothing special in your configuration - Dalli will pick up the MEMCACHE_SERVERS environment variable and use those server(s).
# config/environments/production.rb config.cache_store = :dalli_store # Gemfile gem 'dalli'
require 'dalli' set :cache, Dalli::Client.new # use the settings convention to access your cache settings.cache.set('color', 'blue')
Just like with Rails, Dalli will automatically pick up Heroku's MEMCACHE environment variables. However if you need to setup something specific, such as an
expires_in option, here's how:
Dalli::Client.new(ENV['MEMCACHE_SERVERS'], :username => ENV['MEMCACHE_USERNAME'], :password => ENV['MEMCACHE_PASSWORD'], :expires_in => 300)