The increment methods enable you to increase a given stored integer value. These are the incremental equivalent of the decrement operations and work on the same basis; updating the value of a key if it can be parsed to an integer. The update operation occurs on the server and is provided at the protocol level. This simplifies what would otherwise be a two-stage get and set operation.
|Description||Increment the value of an existing numeric key. Couchbase Server stores numbers as unsigned numbers, therefore if you try to increment an existing negative number, it will cause an integer overflow and return a non-logical numeric result. If a key does not exist, this method will initialize it with the zero or a specified value.|
|Document ID used to identify the value|
|Integer offset value to increment/decrement (default 1)|
|Value to be stored if key does not already exist|
|Expiry time for key. Values larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch).|
The first form of the
accepts the keyname and offset (increment) value to be used when
increasing the server-side integer. For example, to increment the
dlcounter by 5:
The return value is the updated value of the specified key.