'Sets multiple key/value pairs in memcache.
:param mapping: dictionary of keys and values to be set in memcache
:param server_key: key to use in determining which server in the ring
is used
:param serialize: if True, value is serialized with JSON before sending
to memcache, or with pickle if configured to use
pickle instead of JSON (to avoid cache poisoning)
:param time: the time to live
:min_compress_len: minimum compress length, this parameter was added
to keep the signature compatible with
python-memcached interface. This implementation
ignores it'

def set_multi(self, mapping, server_key, serialize=True, time=0, min_compress_len=0):

    server_key = md5hash(server_key)
    timeout = sanitize_timeout(time)
    msg = ''
    for (key, value) in mapping.items():
        key = md5hash(key)
        flags = 0
        if (serialize and self._allow_pickle):
            value = pickle.dumps(value, PICKLE_PROTOCOL)
            flags |= PICKLE_FLAG
        elif serialize:
            value = json.dumps(value)
            flags |= JSON_FLAG
        msg += ('set    %s    %d    %d    %s\r\n%s\r\n' % (key, flags, timeout, len(value), value))
    for (server, fp, sock) in self._get_conns(server_key):
        try:
            with Timeout(self._io_timeout):
                sock.sendall(msg)
                for line in range(len(mapping)):
                    fp.readline()
                self._return_conn(server, fp, sock)
                return
        except (Exception, Timeout) as e:
            self._exception_occurred(server, e, sock=sock, fp=fp)
