RANDOMKEY
Syntax
RANDOMKEY
Module
genericCategories
slow read keyspaceDescription
Returns a random key from the currently selected database. If no keys are available, an empty string is returned.
Examples
- Go (Embedded)
- CLI
Get a random key from the database:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
key, err := db.RandomKey()
Get a random key from the database:
> RANDOMKEY