Crate ntex_redis

Source
Expand description

Redis client for ntex framework.

§Example

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?;
    let key = gen_random_key();

    // create list with one value
    redis.exec(cmd::LPush(&key, "value")).await?;

    // get value by index
    let value = redis.exec(cmd::LIndex(&key, 0)).await?;
    assert_eq!(value.unwrap(), "value");

    // remove key
    redis.exec(cmd::Del(&key)).await?;

    Ok(())
}

Modules§

cmd
Redis commands
codec
Redis protocol codec
errors
Redis protocol related errors

Macros§

array
Macro to create a request array, useful for preparing commands to send. Elements can be any type, or a mixture of types, that satisfy Into<Request>.

Structs§

Client
Shared redis client
RedisConnector
Redis connector
SimpleClient
Redis client
SubscriptionClient
Redis pubsub client to receive push messages