Skip to content

Redis client

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

ntex-rs/ntex-redis

Repository files navigation

ntex redis build status codecov crates.io

redis client for ntex framework

Documentation & community resources

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?;

    // create list with one value
    redis.exec(cmd::LPush("test", "value"));

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

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

    Ok(())
}

License

This project is licensed under