INCR
AttentionThis page documents an earlier version. Go to the latest (v2.1)version.
Synopsis
INCR keyThis command adds 1 to the number that is associated with the given key. The numeric value must a 64-bit signed integer.
- If the
keydoes not exist, the associated string is set to “0”. - If the given
keyis associated with a non-string value, or if its associated string cannot be converted to an integer, an error is raised.
Return Value
Returns the value after addition.
Examples
You can do this as shown below.
1. $ SET yugakey 7
1. "OK"
1. $ INCR yugakey
1. 8
See Also
append, get, getrange, getset, incrby, set, setrange, strlen
