SPOP
Syntax
SPOP key [count]
Module
setCategories
set slow writeDescription
Returns and removes one or more random members from the set.
Examples
- Go (Embedded)
- CLI
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)
Pop one element from the set:
> SPOP key
Pop 5 elements from the set:
> SPOP key 5