Use Redis as Cache store for Rails
1. In Gemfile:
gem "redis-store"
gem 'redis-rails'
gem "redis-rack-cache"
2. In config/environments/production.rb:
config.cache_store = :redis_store, 'redis://localhost:6379/1'
config.action_dispatch.rack_cache = {
metastore: "redis://localhost:6379/1/metastore",
entitystore: "redis://localhost:6379/1/entitystore"
}
3. In Config.ru:
require 'rack'
require 'rack/cache'
require 'redis-rack-cache'
use Rack::Cache,
metastore: 'redis://localhost:6379/1/metastore',
entitystore: 'redis://localhost:6379/1/entitystore'
Written by Truong Hoang Dung
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#