Skip to main content

RANDOMKEY

Syntax

RANDOMKEY

Module

generic

Categories

slow read keyspace

Description

Returns a random key from the currently selected database. If no keys are available, an empty string is returned.

Examples

Get a random key from the database:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
key, err := db.RandomKey()