pub struct Config {
pub urls: Option<Vec<String>>,
pub connections: Option<Vec<ConnectionInfo>>,
pub pool: Option<PoolConfig>,
}
๐Deprecated since 0.1.1: The functionality of
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.Expand description
Configuration object.
ยงExample (from environment)
By enabling the serde
feature you can read the configuration using the
config
crate as following:
REDIS_CLUSTER__URLS=redis://127.0.0.1:7000,redis://127.0.0.1:7001
REDIS_CLUSTER__POOL__MAX_SIZE=16
REDIS_CLUSTER__POOL__TIMEOUTS__WAIT__SECS=2
REDIS_CLUSTER__POOL__TIMEOUTS__WAIT__NANOS=0
#[derive(serde::Deserialize)]
struct Config {
redis_cluster: deadpool_redis_cluster::Config,
}
impl Config {
pub fn from_env() -> Result<Self, config::ConfigError> {
let mut cfg = config::Config::builder()
.add_source(
config::Environment::default()
.separator("__")
.try_parsing(true)
.list_separator(","),
)
.build()?;
cfg.try_deserialize()
}
}
Fieldsยง
ยงurls: Option<Vec<String>>
๐Deprecated since 0.1.1: The functionality of
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.Redis URLs.
connections: Option<Vec<ConnectionInfo>>
๐Deprecated since 0.1.1: The functionality of
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.redis::ConnectionInfo
structures.
pool: Option<PoolConfig>
๐Deprecated since 0.1.1: The functionality of
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.Pool configuration.
Implementationsยง
Sourceยงimpl Config
impl Config
Sourcepub fn create_pool(
&self,
runtime: Option<Runtime>,
) -> Result<Pool, CreatePoolError>
๐Deprecated since 0.1.1: The functionality of redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.
pub fn create_pool( &self, runtime: Option<Runtime>, ) -> Result<Pool, CreatePoolError>
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.Sourcepub fn builder(&self) -> Result<PoolBuilder, ConfigError>
๐Deprecated since 0.1.1: The functionality of redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.
pub fn builder(&self) -> Result<PoolBuilder, ConfigError>
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.Sourcepub fn get_pool_config(&self) -> PoolConfig
๐Deprecated since 0.1.1: The functionality of redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.
pub fn get_pool_config(&self) -> PoolConfig
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.Returns deadpool::managed::PoolConfig
which can be used to construct
a deadpool::managed::Pool
instance.
Sourcepub fn from_urls<T: Into<Vec<String>>>(urls: T) -> Config
๐Deprecated since 0.1.1: The functionality of redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.
pub fn from_urls<T: Into<Vec<String>>>(urls: T) -> Config
redis_cluster_async
has been merged into the
redis
crate rendering this crate obsolete. Please use deadpool-redis
instead.Creates a new Config
from the given Redis URL (like
redis://127.0.0.1
).
Trait Implementationsยง
Sourceยงimpl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Sourceยงfn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementationsยง
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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