INCR
This page documents the preview (v2.21) version. Preview includes features under active development and is for development and testing only. For production, use the stable (v2024.1) version.
Synopsis
INCR key
This 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
$ SET yugakey 7
"OK"
$ INCR yugakey
8
See also
append, get, getrange, getset, incrby, set, setrange, strlen