Redis Client Getname Command
The Redis Client Getname command is used to returnCLIENT SETNAMEthe name set for the connection by the command. Because newly created connections have no name 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 has no name set, a blank reply is returned; if a name is set, the name is returned.
Examples
# 新连接默认没有名字 redis 127.0.0.1:6379> CLIENT GETNAME (nil) # 设置名字 redis 127.0.0.1:6379> CLIENT SETNAME hello-world-connection OK # 返回名字 redis 127.0.0.1:6379> CLIENT GETNAME "hello-world-connection"
Other Extensions