Start by adding the dalli gem to your Gemfile.
Dalli is a Ruby memcache client.
Then run bundle install:
$ bundle install
Once this gem is installed you’ll want to configure the Rails
cache_store appropriately. Modify your
config/environments/production.rb with the following:
The values for
MEMCACHIER_PASSWORD are listed on your cache overview page. Make sure to add them to your environment.
In your development environment, Rails.cache defaults to a simple in-memory store and so it doesn’t require a running memcached.
From here you can use the following code examples to use the cache in your Rails app:
When adding the dalli gem to your Rails 2 Gemfile you will need to use dalli v1.0.5 as later versions of Dalli don’t support Rails 2.
config/environment.rb to contain:
Else proceed just as newer Rails versions.