I am trying to use memcache-client to store session. I have found great
instructions online. However, I keep getting error and fail to start
rails on radrails.
I have “gem install memcache-client”:
============ gem list ===============
memcache-client (1.3.0)
A Ruby memcached client
I’ve configured with the following:
=========== environment.rb ===============
require_gem ‘memcache-client’
Rails::Initializer.run do |config|
config.action_controller.session_store =:mem_cache_store
end
memcache_options = {
:compression => true,
:debug => false,
:namespace => “pr-#{RAILS_ENV}”,
:readonly => false,
:urlencode => false
}
memcache_servers = [ ‘127.0.0.1:11211’ ]
CACHE = MemCache.new(memcache_options)
CACHE.servers = memcache_servers
ActionController::Base.session_options[:cache] = CACHE
I keep getting either of these errors (depending on whichever one comes
first in environment.rb:
=========== errors ===============
uninitialized constant CGI::Session::MemCacheStore (NameError)
uninitialized constant MemCache (NameError)
memcache-client appears to have loaded properly with require_gem. I
tried changing the config many times, but keep getting these errors.
Any help would be greatly appreciated.
thanks a lot!
-Krates