Skip to main content

INCRBY

Syntax

INCRBY key increment

Module

generic

Categories

fast write

Description

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

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")