YouTip LogoYouTip

Server Client Getname

# Redis Client Getname Command Image 3Redis Server The Redis CLIENT GETNAME command returns the name previously set for the connection using the CLIENT SETNAME command. Since newly created connections have no name by default, CLIENT GETNAME returns a null reply for unnamed connections. ### Syntax The basic syntax of the Redis CLIENT GETNAME command is as follows:
redis 127.0.0.1:6379> CLIENT GETNAME
### Available since >= 2.6.9 ### Return value Returns a null reply if the connection has no name; otherwise, returns the name. ### Examples
# A new connection has no name by default
redis 127.0.0.1:6379> CLIENT GETNAME
(nil)

# Set a name
redis 127.0.0.1:6379> CLIENT SETNAME hello-world-connection
OK

# Retrieve the name
redis 127.0.0.1:6379> CLIENT GETNAME
"hello-world-connection"
Image 4Redis Server
← Server Config GetPub Sub Punsubscribe β†’