Skip to main content

Pipeline

Struct Pipeline 

Source
pub struct Pipeline { /* private fields */ }
Expand description

A batch of commands to be sent in a single network round-trip.

Build the pipeline with the typed builder methods, then execute it with [Client::execute_pipeline].

Implementations§

Source§

impl Pipeline

Source

pub fn new() -> Self

Creates an empty pipeline.

Source

pub fn len(&self) -> usize

Returns the number of queued commands.

Source

pub fn is_empty(&self) -> bool

Returns true if no commands have been queued.

Source

pub fn send(self, args: &[&str]) -> Self

Queues a raw command from string slices.

Useful for commands not covered by the typed builders.

Source

pub fn get(self, key: &str) -> Self

Queues a GET key command.

Source

pub fn set(self, key: &str, value: impl AsRef<[u8]>) -> Self

Queues a SET key value command.

Source

pub fn del(self, keys: &[&str]) -> Self

Queues a DEL key [key ...] command.

Source

pub fn expire(self, key: &str, seconds: u64) -> Self

Queues an EXPIRE key seconds command.

Source

pub fn incr(self, key: &str) -> Self

Queues an INCR key command.

Source

pub fn decr(self, key: &str) -> Self

Queues a DECR key command.

Source

pub fn incrby(self, key: &str, delta: i64) -> Self

Queues an INCRBY key delta command.

Source

pub fn ping(self) -> Self

Queues a PING command.

Source

pub fn exists(self, keys: &[&str]) -> Self

Queues an EXISTS key [key ...] command.

Source

pub fn ttl(self, key: &str) -> Self

Queues a TTL key command.

Source

pub fn lpush<V: AsRef<[u8]>>(self, key: &str, values: &[V]) -> Self

Queues an LPUSH key value [value ...] command.

Source

pub fn rpush<V: AsRef<[u8]>>(self, key: &str, values: &[V]) -> Self

Queues an RPUSH key value [value ...] command.

Source

pub fn lpop(self, key: &str) -> Self

Queues an LPOP key command.

Source

pub fn rpop(self, key: &str) -> Self

Queues an RPOP key command.

Source

pub fn llen(self, key: &str) -> Self

Queues an LLEN key command.

Source

pub fn hget(self, key: &str, field: &str) -> Self

Queues an HGET key field command.

Source

pub fn hset<V: AsRef<[u8]>>(self, key: &str, pairs: &[(&str, V)]) -> Self

Queues an HSET key field value [field value ...] command.

Source

pub fn hdel(self, key: &str, fields: &[&str]) -> Self

Queues an HDEL key field [field ...] command.

Source

pub fn hincrby(self, key: &str, field: &str, delta: i64) -> Self

Queues an HINCRBY key field delta command.

Source

pub fn sadd(self, key: &str, members: &[&str]) -> Self

Queues an SADD key member [member ...] command.

Source

pub fn srem(self, key: &str, members: &[&str]) -> Self

Queues an SREM key member [member ...] command.

Source

pub fn scard(self, key: &str) -> Self

Queues an SCARD key command.

Source

pub fn zadd(self, key: &str, members: &[(f64, &str)]) -> Self

Queues a ZADD key score member [score member ...] command.

Source

pub fn zcard(self, key: &str) -> Self

Queues a ZCARD key command.

Source

pub fn zscore(self, key: &str, member: &str) -> Self

Queues a ZSCORE key member command.

Source

pub fn strlen(self, key: &str) -> Self

Queues a STRLEN key command.

Source

pub fn incr_by_float(self, key: &str, delta: f64) -> Self

Queues an INCRBYFLOAT key delta command.

Source

pub fn key_type(self, key: &str) -> Self

Queues a TYPE key command.

Source

pub fn keys(self, pattern: &str) -> Self

Queues a KEYS pattern command.

Source

pub fn rename(self, key: &str, newkey: &str) -> Self

Queues a RENAME key newkey command.

Source

pub fn pexpire(self, key: &str, millis: u64) -> Self

Queues a PEXPIRE key millis command.

Queues an UNLINK key [key ...] command.

Source

pub fn hmget(self, key: &str, fields: &[&str]) -> Self

Queues an HMGET key field [field ...] command.

Source

pub fn echo(self, message: &str) -> Self

Queues an ECHO message command.

Source

pub fn publish(self, channel: &str, message: impl AsRef<[u8]>) -> Self

Queues a PUBLISH channel message command.

Trait Implementations§

Source§

impl Default for Pipeline

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.