pub struct CacheMiddlewareBuilder<B, C, CM> { /* private fields */ }Expand description
Builder for constructing CacheMiddleware with a fluent API.
Obtained via CacheMiddleware::builder().
Both backend() and config()
must be called before build().
See the crate-level documentation for usage examples.
Implementations§
Source§impl<B, C, CM> CacheMiddlewareBuilder<B, C, CM>
impl<B, C, CM> CacheMiddlewareBuilder<B, C, CM>
Sourcepub fn backend<NB>(self, backend: NB) -> CacheMiddlewareBuilder<Arc<NB>, C, CM>where
NB: CacheBackend,
pub fn backend<NB>(self, backend: NB) -> CacheMiddlewareBuilder<Arc<NB>, C, CM>where
NB: CacheBackend,
Sets the cache backend.
Sourcepub fn config<NC>(self, configuration: NC) -> CacheMiddlewareBuilder<B, NC, CM>
pub fn config<NC>(self, configuration: NC) -> CacheMiddlewareBuilder<B, NC, CM>
Sets the cache configuration.
Use Config::builder() to create a configuration.
Sourcepub fn concurrency_manager<NCM>(
self,
concurrency_manager: NCM,
) -> CacheMiddlewareBuilder<B, C, NCM>
pub fn concurrency_manager<NCM>( self, concurrency_manager: NCM, ) -> CacheMiddlewareBuilder<B, C, NCM>
Sets the concurrency manager for dogpile prevention.
Defaults to NoopConcurrencyManager if not called.
Sourcepub fn cache_status_header(self, header_name: HeaderName) -> Self
pub fn cache_status_header(self, header_name: HeaderName) -> Self
Sets the header name for cache status.
The cache status header indicates whether a response was served from cache.
Possible values are HIT, MISS, or STALE.
Defaults to x-cache-status if not set.
Source§impl<B, C, CM> CacheMiddlewareBuilder<Arc<B>, C, CM>where
B: CacheBackend,
impl<B, C, CM> CacheMiddlewareBuilder<Arc<B>, C, CM>where
B: CacheBackend,
Sourcepub fn build(self) -> CacheMiddleware<B, C, CM>
pub fn build(self) -> CacheMiddleware<B, C, CM>
Source§impl CacheMiddlewareBuilder<NotSet, NotSet, NoopConcurrencyManager>
impl CacheMiddlewareBuilder<NotSet, NotSet, NoopConcurrencyManager>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new builder. Equivalent to CacheMiddleware::builder().
Trait Implementations§
Auto Trait Implementations§
impl<B, C, CM> !Freeze for CacheMiddlewareBuilder<B, C, CM>
impl<B, C, CM> RefUnwindSafe for CacheMiddlewareBuilder<B, C, CM>
impl<B, C, CM> Send for CacheMiddlewareBuilder<B, C, CM>
impl<B, C, CM> Sync for CacheMiddlewareBuilder<B, C, CM>
impl<B, C, CM> Unpin for CacheMiddlewareBuilder<B, C, CM>
impl<B, C, CM> UnwindSafe for CacheMiddlewareBuilder<B, C, CM>
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