pub struct TieredCacheBuilder { /* private fields */ }Expand description
Builder for creating configured TieredCache instances
This builder provides a fluent interface for configuring tiered cache instances with L1 (memory) and L2 (Redis) layers.
§Example
ⓘ
use oxcache::builder::TieredCacheBuilder;
use std::time::Duration;
let backend = TieredCacheBuilder::new()
.l1_capacity(10000)
.l1_ttl(Duration::from_secs(3600))
.l2_connection_string("redis://localhost:6379")
.l2_mode(RedisMode::Standalone)
.auto_promote(true)
.batch_writes(true)
.build()?;Implementations§
Source§impl TieredCacheBuilder
impl TieredCacheBuilder
Sourcepub fn l1_capacity(self, capacity: u64) -> Self
pub fn l1_capacity(self, capacity: u64) -> Self
Sourcepub fn l2_connection_string(self, connection_string: &str) -> Self
pub fn l2_connection_string(self, connection_string: &str) -> Self
Sourcepub fn auto_promote(self, enabled: bool) -> Self
pub fn auto_promote(self, enabled: bool) -> Self
Sourcepub fn batch_writes(self, enabled: bool) -> Self
pub fn batch_writes(self, enabled: bool) -> Self
Sourcepub fn bloom_filter(self, enabled: bool) -> Self
pub fn bloom_filter(self, enabled: bool) -> Self
Sourcepub async fn build(self) -> Result<Arc<dyn CacheBackend>>
pub async fn build(self) -> Result<Arc<dyn CacheBackend>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TieredCacheBuilder
impl RefUnwindSafe for TieredCacheBuilder
impl Send for TieredCacheBuilder
impl Sync for TieredCacheBuilder
impl Unpin for TieredCacheBuilder
impl UnwindSafe for TieredCacheBuilder
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more