DECR

Decrements an integer string value by one.

Strings · Example verified

Syntax covered here

DECR key

GET confirms the changed value after decrementing an existing counter.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> SET counter 10
"OK"
# connection: default
> DECR counter
9
# connection: default
> GET counter
"9"