Project

General

Profile

Feature #196

Adding Redmine to a Centralized Memcache Server

Added by Daniel Curtis over 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
09/13/2013
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:

Description

I encountered the need to have centralized session management for the multiple instances of the same content. This is where memcache comes in. First the gem for memcache needs to be installed:

sudo gem install memcache-client

Next, add the environment code to the end of config/environment.rb to utilize the memcache server:
# Load memcache
require 'memcache'

config.action_controller.session_store = :mem_cache_store

memcache_options = {
   :compression => true,
   :debug => false,
   :namespace => "mem-#{RAILS_ENV}",
   :readonly => false,
   :urlencode => false
}

memcache_servers = [ 'memcacheIP:11211' ]

CACHE = MemCache.new(memcache_options)
CACHE.servers = memcache_servers
ActionController::Base.session_options[:cache] = CACHE

Also available in: Atom PDF