DECR

Since 1.1.0Strings

Syntax

DECR key
  • Flags: fast, write
  • ACL categories: @fast, @string, @write
  • Arity: 2

Subtracts 1 from the integer stored at key. A missing key counts as 0.

Reply

  • The value after the decrement.
  • ERR increment or decrement would overflow below -9223372036854775808.
  • ERR value is not an integer or out of range if the value is not an integer.

Examples

> SET n 10
OK
> DECR n
(integer) 9