Problem
I'm getting the error:
key too long "rack:session:BAh7...."
/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/memcache.rb:703:in `get_server_for_key'
/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/memcache.rb:920:in `request_setup'
/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/memcache-client-1.8.5/lib/memcache.rb:885:in `with_server'
When I looked at memcache-client-1.8.5/lib/memcache.rb:703
def get_server_for_key(key, options = {})
raise ArgumentError, "illegal character in key #{key.inspect}" if key =~ /\s/
raise ArgumentError, "key too long #{key.inspect}" if key.length > 250
...
end
Also according http://code.google.com/p/memcached/wiki/FAQ#What_is_the_maxiumum_key_length?_(250_bytes) the max length is 250 bytes.
Since this is production and is pretty hard to replicate this error, i figured i can ask here if any one had the same issue before.
Question 1: Can I remove the statement from the memcache-client?
Question 2: Is there any way to reduced the key size in rails? I'm using the below in my production.rb
config.action_controller.session_store = :mem_cache_store