pub struct CacheConfig {
pub max_entries: usize,
pub ttl: Duration,
pub negative_ttl: Duration,
pub background_refresh: bool,
pub refresh_threshold: f64,
pub enable_metrics: bool,
}Expand description
Configuration for the tenant cache.
Fields§
§max_entries: usizeMaximum number of entries in the cache.
ttl: DurationTime-to-live for cached entries.
negative_ttl: DurationTime-to-live for negative cache entries (tenant not found).
background_refresh: boolEnable background refresh before TTL expires.
refresh_threshold: f64How long before TTL to start background refresh (e.g., 0.8 = refresh at 80% of TTL).
enable_metrics: boolEnable metrics collection.
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn with_negative_ttl(self, ttl: Duration) -> Self
pub fn with_negative_ttl(self, ttl: Duration) -> Self
Set the negative TTL.
Sourcepub fn without_background_refresh(self) -> Self
pub fn without_background_refresh(self) -> Self
Disable background refresh.
Sourcepub fn with_refresh_threshold(self, threshold: f64) -> Self
pub fn with_refresh_threshold(self, threshold: f64) -> Self
Set the refresh threshold.
Sourcepub fn without_metrics(self) -> Self
pub fn without_metrics(self) -> Self
Disable metrics.
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 · 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
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin 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