pub struct MemcachedBackendBuilder { /* private fields */ }Expand description
Builder for MemcachedBackend.
Timeout and pool defaults mirror cachekit-py’s MemcachedBackendConfig
(1s op timeout, 2s connect timeout, pool of 10).
Implementations§
Source§impl MemcachedBackendBuilder
impl MemcachedBackendBuilder
Sourcepub fn url(self, url: impl Into<String>) -> Self
pub fn url(self, url: impl Into<String>) -> Self
Set the memcached server address (required).
Accepts memcache://host:port, tcp://host:port, or bare
host:port.
Sourcepub fn max_item_size_bytes(self, bytes: usize) -> Self
pub fn max_item_size_bytes(self, bytes: usize) -> Self
Reject values larger than this before sending to memcached
(default 1 MiB — the server’s own -I default; 0 disables the
check). Raise this only if the server’s -I limit is raised too.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Socket read/write timeout per operation (default 1s). A hung server errors that operation instead of wedging the backend.
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
TCP connect timeout (default 2s).
Sourcepub async fn connect(self) -> Result<MemcachedBackend, CachekitError>
pub async fn connect(self) -> Result<MemcachedBackend, CachekitError>
Connect to memcached and construct a MemcachedBackend.
Establishes the pool and pings the server (version), so a bad
address fails here rather than on the first cache operation.
§Errors
Returns a config error if url was not provided or is invalid, or a
backend error if the connection cannot be established.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemcachedBackendBuilder
impl RefUnwindSafe for MemcachedBackendBuilder
impl Send for MemcachedBackendBuilder
impl Sync for MemcachedBackendBuilder
impl Unpin for MemcachedBackendBuilder
impl UnsafeUnpin for MemcachedBackendBuilder
impl UnwindSafe for MemcachedBackendBuilder
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
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> ⓘ
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> ⓘ
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