:mem_cache_store and memcache-client

Seems to not be working in that there is no error, but my Rails app is
not keeping track of any session. Fragment cache is working, however. I
have tried many different ways, but just can’t get this to work. My
memcached-vv also looks normal. Can someone please help me, or tell me
where to start looking.

evironment.rb:

require File.join(File.dirname(FILE), ‘boot’)
require_gem ‘memcache-client’

memcache_options = {
:compression => false,
:debug => false,
:namespace => ‘domain’,
:readonly => false,
:urlencode => false
}
memcache_servers = “localhost:11211”

Rails::Initializer.run do |config|
config.action_controller.session_store = :mem_cache_store
config.action_controller.fragment_cache_store = :mem_cache_store,
memcache_servers, memcache_options
#config.action_controller.fragment_cache_store = CACHE, {}
#ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.merge!({
‘cache’ => CACHE })

require ‘hodel_3000_compliant_logger’
config.logger = Hodel3000CompliantLogger.new(config.log_path)
end

cache_params = *([memcache_servers, memcache_options].flatten)
CACHE = MemCache.new *cache_params
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.merge!({ ‘cache’
=> CACHE })

ActionMailer::Base.delivery_method = :smtp

ActionMailer::Base.server_settings = {
:address => “mail.domain.com”,
:port => 25,
:domain => “domain.com”,
}

ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = “utf-8”

require ‘RMagick’
include Magick
require ‘cgi’
require ‘cached_model’
require ‘misc’

Hi,

Above code is working fine,

you assign the memcached server where you run memcache server

memcache_servers = “localhost:11211”

above line you replace localhost as IP(i.e,)where memcache server
running
ex:memcache_servers = “168.162.10.26:11211” – like this

and start memcache server using this cmd

memcached -d -m 256 -u nobody -p 11211 -l 168.162.10.26

any doubt in this mail me.

regrads,
T.Sathish
[email protected]

It seems to be working except that I am getting key too long error. If
possible, can you tell me what I am missing?

I will really appreciate your help.

Processing ApplicationController#index (for 74.203.51.2 at 2009-04-20
23:38:54) [GET]

ActionView::TemplateError (key too long
“rack:session:BAh7FzoQQWRkcmVzc0luZm8wOg9zZXNzaW9uX2lkIiVhNjQ2NDd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2ODsLIg8tMTIyLjM1NjczIgsyMDUyNzd7BzsKIg00Ny42NTk0OTsLIg8tMTIyLjMxNzgxIgsxMTM0MjZ7BzsKIg00Ny42MTM4MTsLIg8tMTIyLjMzNjg2IgsyMzU4OTF7BzsKIg00Ny41OTM2NzsLIg8tMTIyLjMzNDIyIgsyMDYwMDR7BzsKIg00Ny42MjMzMjsLIg8tMTIyLjM1NTQyIgsxMzIxMzh7BzsKIg00Ny42MDY4MjsLIg8tMTIyLjMzMzU4OhJsb2NhdGlvbl9pbmZvMDoSc2VhcmNoX2VuZ2luZTA6EWd1ZXN0X2NvdW50c3sHOg9udW1fYWR1bHRzIgYyOhFudW1fY2hpbGRyZW4iBjA6F2hvdGVsX2Jvb2tpbmdfaW5mbzA6EGZvcm1fcGFyYW1zMDoXZ3Vlc3RfY2xpY2tzX2NvdW50aRo6DXJvb21feG1sIgGGPFJvb21Hcm91cD48Um9vbT48bnVtYmVyT2ZBZHVsdHM+MjwvbnVtYmVyT2ZBZHVsdHM+CjxudW1iZXJPZkNoaWxkcmVuPjA8L251bWJlck9mQ2hpbGRyZW4+CjxjaGlsZEFnZXM+PC9jaGlsZEFnZXM+CjwvUm9vbT48L1Jvb21Hcm91cD46DWxhc3RQYWdlIgYvOhBsYXlvdXRfZmlsZSINYXV0b3Rvb2w6FFJlc2VydmF0aW9uSW5mbzA6GWhvdGVsX2RlcGFydHVyZV9kYXRlIg8wNy8yNy8yMDA5IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsAOhdob3RlbF9hcnJpdmFsX2RhdGUiDzA3LzI1LzIwMDk=–44dde50c649bf5bb1e8e3688fd16e884024ee78d”)
on line #40 of app/views/shared/_header.rhtml:
37: if(typeof(onloadJSDelegate)==‘function’){
38: onloadJSDelegate();
39: }
40: <%if(!flash[:notice].blank?)%>
41: alert(’<%=flash[:notice]%>’)
42: <%end%>
43: }

My config/environment.rb looks like this -
require ‘memcache’
memcache_options = {
:compression => true,
:debug => false,
:namespace => ‘outlook’,
:readonly => false,
:urlencode => false
}

memcache_servers = ‘[IP Address]:11211’

Rails::Initializer.run do |config|

Settings in config/environments/* take precedence over those

specified here

Add additional load paths for your own custom dirs

config.load_paths += %W( #{RAILS_ROOT}/extras )

config.load_paths += %W(
#{RAILS_ROOT}/lib
)

Use the database for sessions instead of the file system

(create the session table with ‘rake db:sessions:create’)

config.action_controller.session_store = :active_record_store

#config.action_controller.fragment_cache_store = :mem_cache_store,
memcache_servers, memcache_options

config.action_controller.session = {
:session_key => ‘_tripoutlook_session_id’,
:secret => ‘tripoutlook_a1b2c3d4e5g6h7i8’
}
config.action_controller.session_store = :mem_cache_store

end

cache_params = *([memcache_servers, memcache_options].flatten)
Cache = MemCache.new *cache_params

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs