Skip to main content

RedisPool

Struct RedisPool 

Source
pub struct RedisPool(pub Pool<Manager>);

Tuple Fields§

§0: Pool<Manager>

Implementations§

Source§

impl RedisPool

Source

pub fn init(uri: &str, db_name: &str) -> Result<Self>

Source

pub async fn instance(&self) -> Result<Object<Manager>>

Source

pub async fn set<K, V>(&self, key: K, value: V) -> Result<()>

SET key value

Source

pub async fn set_ex<K, V>(&self, key: K, value: V, ex: u32) -> Result<()>

SET key value EX seconds

Source

pub async fn get<K, V>(&self, key: K) -> Result<Option<V>>

GET key

Source

pub async fn hset<K, V>(&self, table: &str, key: K, value: V) -> Result<()>
where K: ToRedisArgs, V: ToRedisArgs,

HSET table key value

Source

pub async fn hmset<K, V>(&self, table: &str, pairs: &[(K, V)]) -> Result<()>
where K: ToRedisArgs, V: ToRedisArgs,

HSET table key2 value2 key2 value2

Source

pub async fn hset_ex<K, V>( &self, table: &str, key: K, value: V, ex: u32, ) -> Result<()>
where K: ToRedisArgs, V: ToRedisArgs,

HSET table key value EX seconds

Source

pub async fn hget<K, V>(&self, table: &str, key: K) -> Result<Option<V>>

HGET table key

Source

pub async fn hmget<K, V>(&self, table: &str, keys: &[K]) -> Result<Vec<V>>

HMGET table key1 key2 key3

Source

pub async fn hget_all<K, V>(&self, table: &str) -> Result<Vec<(K, V)>>

HGETALL table

Source

pub async fn hdel<K>(&self, table: &str, key: K) -> Result<()>
where K: ToRedisArgs,

HDEL table key

Source

pub async fn hmdel<K>(&self, table: &str, keys: &[K]) -> Result<()>
where K: ToRedisArgs,

HDEL table key1 key2 key3

Source

pub async fn hdel_all(&self, table: &str) -> Result<()>

DEL table

Source

pub async fn publish<C, M>(&self, channel: C, message: M) -> Result<()>

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> ErasedDestructor for T
where T: 'static,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V