Struct reool::RedisPool[][src]

pub struct RedisPool<T: Poolable = ConnectionFlavour> { /* fields omitted */ }

A pool to one or more Redis instances.

This is the core type of this library.

Overview

Each RedisPool consist of one or more sub pools whereas each sub pool is only ever connected to one Redis node.

So the number of sub pools is usually the number of nodes to connect to. Furthermore the number of sub pools can be increased via the configuration.

Reool uses a stream to enqueue checkouts. Furthermore the number of buffered checkout requests is always limited. Having multiple sub pools will increase the number of checkout requests that can be enqueued.

When having more that one sub pool Reool will retry checkout attempts on different sub pools.

ConnectionLike

The pool itself implements ConnectionLike. This is a convinience functionality for executing a single redis command. The checkout will be done with the DefaultCheckoutMode defined for the pool. Furthermore ConnectionLike::get_db will always return -1.

Implementations

impl RedisPool[src]

pub fn builder() -> Builder[src]

impl<T: Poolable> RedisPool<T>[src]

pub fn no_pool() -> Self[src]

pub fn check_out_default<'a>(
    &'a self
) -> impl Future<Output = Result<PoolConnection<T>, CheckoutError>> + 'a
[src]

Checkout a new connection and if the request has to be enqueued use a timeout as defined by the pool as a default.

pub async fn check_out<M: Into<CheckoutMode>>(
    &self,
    mode: M
) -> Result<PoolConnection<T>, CheckoutError>
[src]

Checkout a new connection and choose whether to wait for a connection or not as defined by the CheckoutMode.

pub fn default_command_timeout<TO: Into<DefaultCommandTimeout>>(
    &self,
    default_command_timeout: TO
) -> Self
[src]

Creates a clone with the given default command timeout.

This creates a new instance since mutating this might go unnoticed as callers which pass the pool as a mutable reference would not expect this value to be changed by downstream code as passing this mutably is mostly for the purpose of directly executing Redis commands.

pub fn connected_to(&self) -> Vec<String>[src]

pub fn state(&self) -> PoolState[src]

pub fn ping_nodes<TO: Into<Timeout>>(
    &self,
    timeout: TO
) -> BoxFuture<'_, Vec<Ping>>
[src]

Ping all the nodes which this pool is connected to.

timeout is the maximum time allowed for a ping.

This method only fails with () if the underlying connection does not support pinging. All other errors will be contained in the returned Ping struct.

Trait Implementations

impl<T: Poolable> Clone for RedisPool<T>[src]

impl ConnectionLike for RedisPool[src]

Auto Trait Implementations

impl<T = ConnectionFlavour> !RefUnwindSafe for RedisPool<T>

impl<T> Send for RedisPool<T>

impl<T> Sync for RedisPool<T>

impl<T> Unpin for RedisPool<T>

impl<T = ConnectionFlavour> !UnwindSafe for RedisPool<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsyncCommands for T where
    T: ConnectionLike + Send
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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