pub struct CacheConfig {
pub backend: CacheBackend,
pub url: String,
pub key_prefix: Option<String>,
pub default_ttl: Option<Duration>,
pub connection_timeout: Duration,
pub operation_timeout: Duration,
pub max_connections: usize,
}Expand description
Cache configuration.
Fields§
§backend: CacheBackendCache backend type
url: StringConnection URL
key_prefix: Option<String>Key prefix for all cache keys
default_ttl: Option<Duration>Default TTL for cache entries
connection_timeout: DurationConnection timeout
operation_timeout: DurationOperation timeout
max_connections: usizeMaximum number of connections (for connection pools)
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn redis(url: impl Into<String>) -> CacheResult<Self>
pub fn redis(url: impl Into<String>) -> CacheResult<Self>
Sourcepub fn memcached(url: impl Into<String>) -> CacheResult<Self>
pub fn memcached(url: impl Into<String>) -> CacheResult<Self>
Sourcepub fn with_key_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_key_prefix(self, prefix: impl Into<String>) -> Self
Set the key prefix.
Sourcepub fn with_default_ttl(self, ttl: Duration) -> Self
pub fn with_default_ttl(self, ttl: Duration) -> Self
Set the default TTL.
Sourcepub fn with_connection_timeout(self, timeout: Duration) -> Self
pub fn with_connection_timeout(self, timeout: Duration) -> Self
Set the connection timeout.
Sourcepub fn with_operation_timeout(self, timeout: Duration) -> Self
pub fn with_operation_timeout(self, timeout: Duration) -> Self
Set the operation timeout.
Sourcepub fn with_max_connections(self, max: usize) -> Self
pub fn with_max_connections(self, max: usize) -> Self
Set the maximum number of connections.
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 moreAuto 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