Latest web development tutorials

Redis Client Getname command

Redis server

Redis Client Getname command returns CLIENT SETNAME command set for the connection name. Because the newly created connection default is no name, no name for the connection, CLIENT GETNAME return a blank response.

grammar

redis Client Getname basic command syntax is as follows:

redis 127.0.0.1:6379> CLIENT GETNAME

Available versions

> = 2.6.9

return value

If the connection name is not set, then return a blank reply; if you have set the name, 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"

Redis server