English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Client Getname Command

Redis Server

The Redis Client Getname command is used to return CLIENT SETNAME The name set for the connection by the command. Because new connections are not named by default, CLIENT GETNAME returns a blank reply for connections without a name.

Syntax

The basic syntax of the redis Client Getname command is as follows:

redis 127.0.0.1:6379> CLIENT GETNAME

Available Versions

>= 2.6.9

Return Value

If the connection is not named, then return a blank reply; If a name is set, then return the name.

Online Examples

# New connections are not named by default
redis 127.0.0.1:6379> CLIENT GETNAME
(nil)
# Set name
redis 127.0.0.1:6379> CLIENT SETNAME hello-world-connection
OK
# Return name
redis 127.0.0.1:6379> CLIENT GETNAME
"hello-world-connection"

Redis Server