pub struct CacheConfig {
pub backend: CacheBackend,
pub endpoint: Option<String>,
pub namespace: Option<String>,
}Expand description
Cache settings, deserialized from the cache section of config/<env>.yml.
cache:
type: redis # memory | redis | memcache
endpoint: redis://127.0.0.1:6379 # backend address (redis/memcache)
namespace: myapp # optional key prefixFields§
§backend: CacheBackendBackend kind. YAML key is type.
endpoint: Option<String>Connection address for the redis/memcache backends. Ignored by
memory. Defaults to the backend’s standard localhost address.
namespace: Option<String>Optional key prefix applied to every key (via NamespacedStore).
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub async fn build(&self) -> Result<Arc<dyn CacheStore>>
pub async fn build(&self) -> Result<Arc<dyn CacheStore>>
Builds the configured CacheStore, wrapping it in a NamespacedStore
when namespace is set. Connecting to Redis/Memcached happens here, so
this is async and can fail.
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
Source§fn default() -> CacheConfig
fn default() -> CacheConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CacheConfig
impl<'de> Deserialize<'de> for CacheConfig
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 CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
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