Skip to main content

LPUSHX

Syntax

LPUSHX key element [element ...]

Module

list

Categories

fast list write

Description

Prepends a value to the beginning of a list only if the list exists.

Examples

Prepends a value to the beginning of a list only if the list exists:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
length, err := db.LPushX("key", "element1", "element2")