Function ntex_redis::cmd::HGet [−][src]
pub fn HGet<T, V>(key: T, field: V) -> BulkOutputCommand where
BulkString: From<T> + From<V>,
HGET redis command
Returns the value associated with field in the hash stored at key.
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 hashmap redis.exec(cmd::HSet(&key, "test-key", "value")).await?; // get field value let value = redis.exec(cmd::HGet(&key, "test-key")).await?; assert_eq!(value.unwrap(), "value"); Ok(()) }