# File lib/redis/store/factory.rb, line 67
      def self.extract_host_options_from_uri(uri)
        uri = URI.parse(uri)
        if uri.scheme == "unix"
          options = { :path => uri.path }
        else
          _, db, namespace = if uri.path
            uri.path.split(/\//)
          end

          options = {
            :scheme   => uri.scheme,
            :host     => uri.hostname,
            :port     => uri.port || DEFAULT_PORT,
            :password => uri.password.nil? ? nil : CGI.unescape(uri.password.to_s)
          }

          options[:db]        = db.to_i   if db
          options[:namespace] = namespace if namespace
        end
        if uri.query
          query = Hash[URI.decode_www_form(uri.query)]
          query.each do |(key, value)|
            options[key.to_sym] = value
          end
        end

        options
      end