Redis command o...login
Redis command operation Chinese manual
author:php.cn  update time:2022-04-12 14:07:28

Redis Ping command


Redis Ping command

Redis connection

The Redis Ping command uses the client to send a PING to the Redis server. If the server If it works normally, a PONG will be returned.

Usually used to test whether the connection to the server is still valid, or to measure latency values.

Syntax

The basic syntax of the redis Ping command is as follows:

redis 127.0.0.1:6379> PING

Available versions

>= 1.0.0

Return value

If the connection is normal, return a PONG, otherwise return a connection error.

Example

# 客户端和服务器连接正常redis 127.0.0.1:6379> PING
PONG# 客户端和服务器连接不正常(网络不正常或服务器未能正常运行)redis 127.0.0.1:6379> PINGCould not connect to Redis at 127.0.0.1:6379: Connection refused

Redis connection

php.cn