Function ntex_redis::cmd::HLen [−][src]
pub fn HLen<T>(key: T) -> IntOutputCommand where
BulkString: From<T>,
HLEN redis command
Returns the number of fields contained 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 and set field redis.exec(cmd::HSet(&key, "test-key", "value")).await?; // get len of hashmap let value = redis.exec(cmd::HLen(&key)).await?; assert_eq!(value, 1); Ok(()) }