RENAMENX
Syntax
RENAMENX key newkey
Module
genericCategories
fast keyspace writeDescription
Renames the specified key with the new name only if the new name does not already exist.
Examples
- Go (Embedded)
- CLI
Rename the key mykey
to newkey
:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
err = db.RenameNX("mykey", "newkey")
Rename the key mykey
to newkey
:
> RENAMENX mykey newkey