pub struct CacheConfig { /* private fields */ }Expand description
The resolved cache configuration (Java CacheConfig record).
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn from_config() -> Self
pub fn from_config() -> Self
Read the tunables and the plain-redis.* connection parameters from
application configuration (Java CacheConfig.from). A missing or
unparseable redis.cache.default.ttl degrades to the built-in 1h
rather than to a zero TTL the server would reject (a port-side
tightening of the Java getDurationInSeconds → 0 behaviour).
Sourcepub fn new(
redis: RedisConfig,
key_prefix: impl Into<String>,
default_ttl_seconds: u64,
) -> Self
pub fn new( redis: RedisConfig, key_prefix: impl Into<String>, default_ttl_seconds: u64, ) -> Self
Explicit constructor for tests and embedders.
Sourcepub fn redis(&self) -> &RedisConfig
pub fn redis(&self) -> &RedisConfig
The shared connection parameters (host/port/auth/ssl/cluster) from redis.*.
Sourcepub fn key_prefix(&self) -> &str
pub fn key_prefix(&self) -> &str
Prepended to every cache key; blank = no prefix.
Sourcepub fn default_ttl_seconds(&self) -> u64
pub fn default_ttl_seconds(&self) -> u64
Default TTL in seconds for writes that omit one.
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§impl Debug for CacheConfig
impl Debug for CacheConfig
impl Eq for CacheConfig
Source§impl PartialEq for CacheConfig
impl PartialEq for CacheConfig
impl StructuralPartialEq for CacheConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.