This is an old revision of the document!


Increment a numerical key’s value by the given number if the key/value pair exists.

syntax:

incr <key> <value> [noreply]

parameters

  • key - The name of the unique key by which data is accessed.
  • value - The data that needs to be stored. This parameter needs to be given on the new line after executing the command with the above options.

example:

incr mykey 4

5

output notes:

  • 4 → Add 4 to the value of “mykey”
  • In this example, if “mykey” had a value of “1”, after running incr, its value would be “5”.

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.

.

  • Admin
  • Last modified: 2016/04/07 14:15
  • by Rob Holda