Skip to main content

SPOP

Syntax

SPOP key [count]

Module

set

Categories

set slow write

Description

Returns and removes one or more random members from the set.

Examples

Pop one element from the set:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
elements, err := db.SPop("key", 1)

Pop 5 elements from the set:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
elements, err := db.SPop("key", 5)