class ActiveSupport::Cache::MemCacheStore
def escape_key(key)
before applying the regular expression to ensure we are escaping all
Memcache keys are binaries. So we need to force their encoding to binary
def escape_key(key) key = key.to_s.dup key = key.force_encoding(Encoding::ASCII_8BIT) key = key.gsub(ESCAPE_KEY_CHARS){ |match| "%#{match.getbyte(0).to_s(16).upcase}" } key = "#{key[0, 213]}:md5:#{Digest::MD5.hexdigest(key)}" if key.size > 250 key end