pub struct CacheMiddlewareConfig<A: HttpCacheAdapter + Send + Sync + 'static> {
pub cache_adapter: Arc<A>,
pub key_generator: HttpCacheKeyGenerator,
pub policy: HttpCachePolicy,
pub bypass_header: Option<String>,
}Expand description
Axum 缓存中间件配置
Fields§
§cache_adapter: Arc<A>§key_generator: HttpCacheKeyGenerator§policy: HttpCachePolicy§bypass_header: Option<String>Implementations§
Source§impl<A: HttpCacheAdapter + Send + Sync + 'static> CacheMiddlewareConfig<A>
impl<A: HttpCacheAdapter + Send + Sync + 'static> CacheMiddlewareConfig<A>
pub fn new(cache_adapter: Arc<A>) -> Self
pub fn with_key_generator(self, key_generator: HttpCacheKeyGenerator) -> Self
pub fn with_policy(self, policy: HttpCachePolicy) -> Self
pub fn with_bypass_header(self, header: String) -> Self
Trait Implementations§
Source§impl<A: Clone + HttpCacheAdapter + Send + Sync + 'static> Clone for CacheMiddlewareConfig<A>
impl<A: Clone + HttpCacheAdapter + Send + Sync + 'static> Clone for CacheMiddlewareConfig<A>
Source§fn clone(&self) -> CacheMiddlewareConfig<A>
fn clone(&self) -> CacheMiddlewareConfig<A>
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 moreAuto Trait Implementations§
impl<A> Freeze for CacheMiddlewareConfig<A>
impl<A> RefUnwindSafe for CacheMiddlewareConfig<A>where
A: RefUnwindSafe,
impl<A> Send for CacheMiddlewareConfig<A>
impl<A> Sync for CacheMiddlewareConfig<A>
impl<A> Unpin for CacheMiddlewareConfig<A>
impl<A> UnwindSafe for CacheMiddlewareConfig<A>where
A: RefUnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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