DECRBY
Syntax
DECRBY key decrement
Module
genericCategories
fast writeDescription
The DECRBY command reduces the value stored at the specified key by the specified decrement. If the key does not exist, it is initialized with a value of 0 before performing the operation. If the key's value is not of the correct type or cannot be represented as an integer, an error is returned.
Examples
- Go (Embedded)
- CLI
Decrement the value of the key mykey
by 5:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
value, err := db.DecrBy("mykey 5")
Decrement the value of the key mykey
by 5:
> DECRBY mykey 5