Skip to content

rainly/rails_redis_cache

 
 

Repository files navigation

About

Cache store implementation for Rails 3 using the key value store Redis.

Usage

In the environment.rb or environments-files write:

ActionController::Base.cache_store = ActiveSupport::Cache::RailsRedisCache.new(:url => ENV['RAILS_REDIS_CACHE_URL'])

... or ...

config.cache_store = ActiveSupport::Cache::RailsRedisCache.new(:url => ENV['RAILS_REDIS_CACHE_URL'])

Using the cache is simple:

@tweets = cache("tweets", :expires_in => 30.seconds){ Twitter::Search.new(...) }

Installing Redis with homebrew

Using a local Redis server for testing is simple:

brew install redis
redis-server

Changelog

See CHANGELOG file for further information.