INCRBY
Syntax
INCRBY key increment
Module
genericCategories
fast writeDescription
Increments the number stored at key by increment. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.
Options
Examples
- Go (Embedded)
- CLI
Increment the value of the key mykey
by 5:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
value, err := db.IncrBy("mykey", "5")
Increment the value of the key mykey
by 5:
> INCRBY mykey 5