    # File lib/memcache.rb, line 378
      def multi_get(keys, opts = {})
        return {} if keys.empty?

        results = {}
        fetch_results = lambda do |server, keys|
          server.get(keys, opts[:cas]).each do |key, value|
            results[key] = opts[:raw] ? value : unmarshal(value, key)
          end
        end

        if @server
          fetch_results.call(@server, keys)
        else
          keys_by_server = Hash.new { |h,k| h[k] = [] }

          # Store keys by servers.
          keys.each do |key|
            keys_by_server[server(key)] << key
          end

          # Fetch and combine the results.
          keys_by_server.each do |server, server_keys|
            fetch_results.call(server, server_keys)
          end
        end

        if backup
          missing_keys = keys - results.keys
          results.merge!(backup.get(missing_keys, opts)) if missing_keys.any?
        end
        results
      end