pub struct HttpStreamingCache<T>where
T: StreamingCacheManager,{
pub mode: CacheMode,
pub manager: T,
pub options: HttpCacheOptions,
}Available on crate feature
streaming only.Expand description
Streaming version of HTTP cache that supports streaming request/response bodies without buffering them in memory.
Fields§
§mode: CacheModeDetermines the manager behavior.
manager: TManager instance that implements the StreamingCacheManager trait.
options: HttpCacheOptionsOverride the default cache options.
Trait Implementations§
Source§impl<T> Clone for HttpStreamingCache<T>where
T: Clone + StreamingCacheManager,
impl<T> Clone for HttpStreamingCache<T>where
T: Clone + StreamingCacheManager,
Source§fn clone(&self) -> HttpStreamingCache<T>
fn clone(&self) -> HttpStreamingCache<T>
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 moreSource§impl<T> Debug for HttpStreamingCache<T>where
T: Debug + StreamingCacheManager,
impl<T> Debug for HttpStreamingCache<T>where
T: Debug + StreamingCacheManager,
Source§impl<T> HttpCacheStreamInterface for HttpStreamingCache<T>where
T: StreamingCacheManager,
<<T as StreamingCacheManager>::Body as Body>::Data: Send,
<<T as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
impl<T> HttpCacheStreamInterface for HttpStreamingCache<T>where
T: StreamingCacheManager,
<<T as StreamingCacheManager>::Body as Body>::Data: Send,
<<T as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
Source§type Body = <T as StreamingCacheManager>::Body
type Body = <T as StreamingCacheManager>::Body
The body type used by this cache implementation
Source§fn analyze_request(
&self,
parts: &Parts,
mode_override: Option<CacheMode>,
) -> Result<CacheAnalysis, Box<dyn Error + Send + Sync>>
fn analyze_request( &self, parts: &Parts, mode_override: Option<CacheMode>, ) -> Result<CacheAnalysis, Box<dyn Error + Send + Sync>>
Analyze a request to determine cache behavior
Source§async fn lookup_cached_response(
&self,
key: &str,
) -> Result<Option<(Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, CachePolicy)>, Box<dyn Error + Send + Sync>>
async fn lookup_cached_response( &self, key: &str, ) -> Result<Option<(Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, CachePolicy)>, Box<dyn Error + Send + Sync>>
Look up a cached response for the given cache key, returning a streaming body
Source§async fn process_response<B>(
&self,
analysis: CacheAnalysis,
response: Response<B>,
metadata: Option<Vec<u8>>,
) -> Result<Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, Box<dyn Error + Send + Sync>>
async fn process_response<B>( &self, analysis: CacheAnalysis, response: Response<B>, metadata: Option<Vec<u8>>, ) -> Result<Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, Box<dyn Error + Send + Sync>>
Process a fresh response from upstream and potentially cache it with streaming support
Source§fn prepare_conditional_request(
&self,
parts: &mut Parts,
_cached_response: &Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>,
policy: &CachePolicy,
) -> Result<(), Box<dyn Error + Send + Sync>>
fn prepare_conditional_request( &self, parts: &mut Parts, _cached_response: &Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, policy: &CachePolicy, ) -> Result<(), Box<dyn Error + Send + Sync>>
Update request headers for conditional requests (e.g., If-None-Match)
Source§async fn handle_not_modified(
&self,
cached_response: Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>,
fresh_parts: &Parts,
) -> Result<Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, Box<dyn Error + Send + Sync>>
async fn handle_not_modified( &self, cached_response: Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, fresh_parts: &Parts, ) -> Result<Response<<HttpStreamingCache<T> as HttpCacheStreamInterface>::Body>, Box<dyn Error + Send + Sync>>
Handle a 304 Not Modified response by returning the cached response
Auto Trait Implementations§
impl<T> Freeze for HttpStreamingCache<T>where
T: Freeze,
impl<T> !RefUnwindSafe for HttpStreamingCache<T>
impl<T> Send for HttpStreamingCache<T>
impl<T> Sync for HttpStreamingCache<T>
impl<T> Unpin for HttpStreamingCache<T>where
T: Unpin,
impl<T> !UnwindSafe for HttpStreamingCache<T>
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> 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