def incr(self, key, amount=1, initial=None, ttl=0): """ Increment the numeric value of a key. :param string key: A key whose counter value is to be incremented :param int amount: an amount by which the key should be incremented :param initial: The initial value for the key, if it does not exist. If the key does not exist, this value is used, and `amount` is ignored. If this parameter is `None` then no initial value is used :type initial: int or `None` :param int ttl: The lifetime for the key, after which it will expire :raise: :exc:`couchbase.exceptions.NotFoundError` if the key does not exist on the bucket (and `initial` was `None`) :raise: :exc:`couchbase.exceptions.DeltaBadvalError` if the key exists, but the existing value is not numeric :return: A :class:`couchbase.libcouchbase.Result` object. The current value of the counter may be obtained by inspecting the return value's `value` attribute. Simple increment:: rv = cb.incr("key") rv.value # 42 Increment by 10:: ok = cb.incr("key", amount=10) Increment by 20, set initial value to 5 if it does not exist:: ok = cb.incr("key", amount=20, initial=5) Increment three keys:: kv = cb.incr_multi(["foo", "bar", "baz"]) for key, result in kv.items(): print "Key %s has value %d now" % (key, result.value) .. seealso:: :meth:`decr` :meth:`incr_multi` """ return _Base.incr(self, key, amount, initial, ttl)