pub struct OptionsCacheConfig { /* private fields */ }Expand description
Configuration for the client-side OPTIONS cache.
The cache is opt-in: a Client only caches OPTIONS
responses when a configuration is supplied via
ClientBuilder::with_options_cache.
§Examples
use std::time::Duration;
use icap_rs::OptionsCacheConfig;
// Cache OPTIONS for 5 minutes when the server does not send `Options-TTL`.
let config = OptionsCacheConfig::new().with_default_ttl(Duration::from_secs(300));
assert_eq!(config.default_ttl(), Some(Duration::from_secs(300)));Implementations§
Source§impl OptionsCacheConfig
impl OptionsCacheConfig
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a configuration with no fallback TTL.
With no fallback, only responses that carry an Options-TTL header are
cached.
Sourcepub const fn with_default_ttl(self, ttl: Duration) -> Self
pub const fn with_default_ttl(self, ttl: Duration) -> Self
Set the fallback lifetime used when a response has no Options-TTL.
Sourcepub const fn default_ttl(&self) -> Option<Duration>
pub const fn default_ttl(&self) -> Option<Duration>
Return the configured fallback lifetime, if any.
Trait Implementations§
Source§impl Clone for OptionsCacheConfig
impl Clone for OptionsCacheConfig
Source§fn clone(&self) -> OptionsCacheConfig
fn clone(&self) -> OptionsCacheConfig
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 moreSource§impl Debug for OptionsCacheConfig
impl Debug for OptionsCacheConfig
Source§impl Default for OptionsCacheConfig
impl Default for OptionsCacheConfig
Source§fn default() -> OptionsCacheConfig
fn default() -> OptionsCacheConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OptionsCacheConfig
impl RefUnwindSafe for OptionsCacheConfig
impl Send for OptionsCacheConfig
impl Sync for OptionsCacheConfig
impl Unpin for OptionsCacheConfig
impl UnsafeUnpin for OptionsCacheConfig
impl UnwindSafe for OptionsCacheConfig
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