Function ntex_redis::cmd::Ping[][src]

pub fn Ping() -> PingCommand
Expand description

PING redis command

This command is often used to test if a connection is still alive, or to measure latency.

use ntex_redis::{cmd, RedisConnector};

#[ntex::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let redis = RedisConnector::new("127.0.0.1:6379").connect().await?;

    // ping connection
    let response = redis.exec(cmd::Ping()).await?;

    assert_eq!(&response, "PONG");

    Ok(())
}