redis-rails
provides a full set of stores (Cache, Session, HTTP Cache) for Ruby on Rails. It natively supports object marshalling, timeouts, single or multiple nodes and namespaces.
MacOS X users should use Homebrew to install Redis:
brew install redis
Download and install Redis from http://redis.io
wget http://redis.googlecode.com/files/redis-2.4.5.tar.gz
tar -zxf redis-2.4.5.tar.gz
mv redis-2.4.5 redis
cd redis
make
# Gemfile
gem 'redis-rails'
# config/environments/production.rb
config.cache_store = :redis_store # { ... optional configuration ... }
# config.cache_store = :redis_store, 'redis://localhost:6379/'
# config.cache_store = :redis_store, 'redis://localhost:6379/0' # database 0
# config.cache_store = :redis_store, 'redis://localhost:6379/0/cache' # database: 0, namespace: cache
# config/initializers/session_store.rb
MyApplication::Application.config.session_store :redis_store
# config.ru
require 'rack'
require 'rack/cache'
require 'redis-rack-cache'
use Rack::Cache,
:metastore => 'redis://localhost:6379/0/metastore',
:entitystore => 'redis://localhost:6380/0/entitystore'
For advanced configuration options, please check the Redis Store Wiki.
git clone git://github.com/jodosha/redis-store.git
cd redis-store/redis-rails
gem install bundler --pre # required version: 1.1.rc
bundle exec rake
If you are on Snow Leopard you have to run env ARCHFLAGS="-arch x86_64" bundle exec rake
(c) 2009 - 2011 Luca Guidi - http://lucaguidi.com, released under the MIT license