Easy Tutorial
❮ Strings Setex Pub Sub Punsubscribe ❯

Redis Client Getname Command

Redis Server

The Redis Client Getname command is used to return the name set for the connection by the CLIENT SETNAME command.

Since newly created connections do not have a default name, CLIENT GETNAME returns a blank reply for connections without a name.

Syntax

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

redis 127.0.0.1:6379> CLIENT GETNAME

Available Versions

= 2.6.9

Return Value

If no name is set for the connection, it returns a blank reply; if a name is set, it returns the name.

Example

# New connection by default has no name

redis 127.0.0.1:6379> CLIENT GETNAME
(nil)

# Set a name

redis 127.0.0.1:6379> CLIENT SETNAME hello-world-connection
OK

# Return the name

redis 127.0.0.1:6379> CLIENT GETNAME
"hello-world-connection"

Redis Server

❮ Strings Setex Pub Sub Punsubscribe ❯