ruby on rails - How to increase key size in Memcached -
problem
i'm getting error:
key 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 looked @ 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 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) max length 250 bytes.
since production , pretty hard replicate error, figured can ask here if 1 had same issue before.
question 1: can remove statement memcache-client?
question 2: is there way reduced key size in rails? i'm using below in production.rb
config.action_controller.session_store = :mem_cache_store
if keys long, hash each key before storing in rails.cache
something this:
def hash_key(string) digest::sha1.hexdigest(string) end
Comments
Post a Comment