Struct relay_redis::RedisPool
source · pub struct RedisPool { /* private fields */ }
Expand description
Abstraction over cluster vs non-cluster mode.
Even just writing a method that takes a command and executes it doesn’t really work because
there’s both Cmd
and ScriptInvocation
to take care of, and both have sync vs async
APIs.
Basically don’t waste your time here, if you want to abstract over this, consider upstreaming to the redis crate.
Implementations§
source§impl RedisPool
impl RedisPool
sourcepub fn new(config: &RedisConfig) -> Result<Self, RedisError>
pub fn new(config: &RedisConfig) -> Result<Self, RedisError>
Creates a RedisPool
from configuration.
sourcepub fn cluster(
servers: Vec<&str>,
opts: RedisConfigOptions
) -> Result<Self, RedisError>
pub fn cluster( servers: Vec<&str>, opts: RedisConfigOptions ) -> Result<Self, RedisError>
Creates a RedisPool
in cluster configuration.
sourcepub fn single(
server: &str,
opts: RedisConfigOptions
) -> Result<Self, RedisError>
pub fn single( server: &str, opts: RedisConfigOptions ) -> Result<Self, RedisError>
Creates a RedisPool
in single-node configuration.
sourcepub fn client(&self) -> Result<PooledClient, RedisError>
pub fn client(&self) -> Result<PooledClient, RedisError>
Returns a pooled connection to a client.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RedisPool
impl Send for RedisPool
impl Sync for RedisPool
impl Unpin for RedisPool
impl !UnwindSafe for RedisPool
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more