This is an old revision of the document!
decr
Decrement a numerical key’s value by the given number if the key/value pair exists.
syntax:
decr <key> <value> [noreply]
parameters:
- value - The data that needs to be stored.
- noreply - This optional parameter tells the server not to send any reply.
example:
decr mykey 3 2
output notes:
- 3 → Subtract 3 from the value of “mykey”
- In this example, if “mykey” had a value of “5”, after running decr, its value would be “2”.
possible errors:
- NOT_FOUND - indicates that the key does not exist.
- CLIENT_ERROR - indicates that the value associated with “mykey” is not numerical.
- ERROR - indicates any other error, such as a syntax error.