ping.3valkey - Man Page
Returns the server’s liveliness response.
Synopsis
PING
[message]
Description
Returns PONG
if no argument is provided, otherwise return a copy of the argument as a bulk. This command is useful for: 1. Testing whether a connection is still alive. 1. Verifying the server’s ability to serve data - an error is returned when this isn’t the case (e.g., during load from persistence or accessing a stale replica). 1. Measuring latency.
If the client is in RESP2 and is subscribed to a channel or a pattern, it will instead return a multi-bulk with a “pong” in the first position and an empty bulk in the second position, unless an argument is provided in which case it returns a copy of the argument.
Reply
Any of the following:
- valkey-protocol(7) Simple string reply:
PONG
when no argument is provided. - valkey-protocol(7) Bulk string reply: the provided argument.
Complexity
O(1)
Acl Categories
@connection @fast
History
- Available since: 1.0.0
Examples
127.0.0.1:6379> PING PONG 127.0.0.1:6379> 127.0.0.1:6379> PING "hello world" "hello world"
See Also
auth(3valkey), client(3valkey), client-caching(3valkey), client-capa(3valkey), client-getname(3valkey), client-getredir(3valkey), client-help(3valkey), client-id(3valkey), client-info(3valkey), client-kill(3valkey), client-list(3valkey), client-no-evict(3valkey), client-no-touch(3valkey), client-pause(3valkey), client-reply(3valkey), client-setinfo(3valkey), client-setname(3valkey), client-tracking(3valkey), client-trackinginfo(3valkey), client-unblock(3valkey), client-unpause(3valkey), echo(3valkey), hello(3valkey), reset(3valkey), select(3valkey)