Function ntex_redis::cmd::RPop [−][src]
pub fn RPop<T>(key: T) -> BulkOutputCommand where
BulkString: From<T>,
Expand description
RPOP redis command
Removes and returns the last element of the list 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 list with one value
redis.exec(cmd::LPush(&key, "value")).await?;
// pop last elements from the list
let value = redis.exec(cmd::RPop(&key)).await?;
assert_eq!(value.unwrap(), "value");
Ok(())
}