decrement


Description:

public uint64 decrement (string key, uint64 initial_value, uint64 offset, time_t expires = -1)

Decrement a stored value by the given offset, provided the value can be parsed as an integer value.

Example:

  // Decrement "num-key" by 1, start at 100 if it doesn't exist.
var cas = client.decrement( "num-key", 100, 1 );

Parameters:

key The key
initial_value Value stored if key doesn't exist
offset Amount to decrement. As Couchbase only deals with unsigned integers, the lowest can be 0.
expires Optionally, the time this key should expires

Returns:

CAS value of key if changed, 0 if not