'Increments a key which has a numeric value by delta.
If the key can\'t be found, it\'s added as delta or 0 if delta < 0.
If passed a negative number, will use memcached\'s decr. Returns
the int stored in memcached
Note: The data memcached stores as the result of incr/decr is
an unsigned int.  decr\'s that result in a number below 0 are
stored as 0.
:param key: key
:param delta: amount to add to the value of key (or set as the value
if the key is not found) will be cast to an int
:param time: the time to live
:returns: result of incrementing
:raises MemcacheConnectionError:'

def incr(self, key, delta=1, time=0):

    key = md5hash(key)
    command = 'incr'
    if (delta < 0):
        command = 'decr'
    delta = str(abs(int(delta)))
    timeout = sanitize_timeout(time)
    for (server, fp, sock) in self._get_conns(key):
        try:
            with Timeout(self._io_timeout):
                sock.sendall(('%s    %s    %s\r\n' % (command, key, delta)))
                line = fp.readline().strip().split()
                if (line[0].upper() == 'NOT_FOUND'):
                    add_val = delta
                    if (command == 'decr'):
                        add_val = '0'
                    sock.sendall(('add    %s    %d    %d    %s\r\n%s\r\n' % (key, 0, timeout, len(add_val), add_val)))
                    line = fp.readline().strip().split()
                    if (line[0].upper() == 'NOT_STORED'):
                        sock.sendall(('%s    %s    %s\r\n' % (command, key, delta)))
                        line = fp.readline().strip().split()
                        ret = int(line[0].strip())
                    else:
                        ret = int(add_val)
                else:
                    ret = int(line[0].strip())
                self._return_conn(server, fp, sock)
                return ret
        except (Exception, Timeout) as e:
            self._exception_occurred(server, e, sock=sock, fp=fp)
    raise MemcacheConnectionError('No    Memcached    connections    succeeded.')
