Streaming version of the HTTP cache interface that supports streaming request/response bodies without buffering them in memory. This is ideal for large responses or when memory usage is a concern.
| 1167 | fn prepare_conditional_request( |
| 1168 | &self, |
| 1169 | parts: &mut request::Parts, |
| 1170 | cached_response: &HttpResponse, |
| 1171 | policy: &CachePolicy, |
| 1172 | ) -> Result<()>; |
| 1173 | |
| 1174 | /// Handle a 304 Not Modified response by returning the cached response |
| 1175 | #[allow(async_fn_in_trait)] |
| 1176 | async fn handle_not_modified( |
| 1177 | &self, |
| 1178 | cached_response: HttpResponse, |
| 1179 | fresh_parts: &response::Parts, |
| 1180 | ) -> Result<HttpResponse>; |
| 1181 | } |
| 1182 | |
| 1183 | /// Streaming version of the HTTP cache interface that supports streaming request/response bodies |
| 1184 | /// without buffering them in memory. This is ideal for large responses or when memory usage |
| 1185 | /// is a concern. |
| 1186 | pub trait HttpCacheStreamInterface: Send + Sync { |
| 1187 | /// The body type used by this cache implementation |
| 1188 | type Body: http_body::Body + Send + 'static; |
| 1189 | |
| 1190 | /// Analyze a request to determine cache behavior |
| 1191 | fn analyze_request( |
| 1192 | &self, |
| 1193 | parts: &request::Parts, |
| 1194 | mode_override: Option<CacheMode>, |
| 1195 | ) -> Result<CacheAnalysis>; |
| 1196 | |
| 1197 | /// Look up a cached response for the given cache key, returning a streaming body |
| 1198 | #[allow(async_fn_in_trait)] |
| 1199 | async fn lookup_cached_response( |
| 1200 | &self, |
| 1201 | key: &str, |
| 1202 | ) -> Result<Option<(Response<Self::Body>, CachePolicy)>> |
| 1203 | where |
| 1204 | <Self::Body as http_body::Body>::Data: Send, |
| 1205 | <Self::Body as http_body::Body>::Error: |
| 1206 | Into<StreamingError> + Send + Sync + 'static; |
| 1207 | |
| 1208 | /// Process a fresh response from upstream and potentially cache it with streaming support |
| 1209 | #[allow(async_fn_in_trait)] |
| 1210 | async fn process_response<B>( |
| 1211 | &self, |
| 1212 | analysis: CacheAnalysis, |
| 1213 | response: Response<B>, |
| 1214 | metadata: Option<Vec<u8>>, |
| 1215 | ) -> Result<Response<Self::Body>> |
| 1216 | where |
| 1217 | B: http_body::Body + Send + 'static, |
| 1218 | B::Data: Send, |
| 1219 | B::Error: Into<StreamingError>, |
| 1220 | <Self::Body as http_body::Body>::Data: Send, |
| 1221 | <Self::Body as http_body::Body>::Error: |
| 1222 | Into<StreamingError> + Send + Sync + 'static; |
| 1223 | |
| 1224 | /// Update request headers for conditional requests (e.g., If-None-Match) |
| 1225 | fn prepare_conditional_request( |
| 1226 | &self, |
nothing calls this directly
no outgoing calls
no test coverage detected