Expand description
Request predicates for cache eligibility.
These predicates evaluate incoming HTTP requests to determine if a cache lookup should be attempted.
§Examples
Cache only GET and HEAD requests:
use hitbox_http::predicates::request::Method;
// Single method
let predicate = Method::new(http::Method::GET).unwrap();
// Multiple methods
let predicate = Method::new_in(
Neutral::new(),
vec![http::Method::GET, http::Method::HEAD],
);Skip cache for requests with Cache-Control: no-cache:
use hitbox::predicate::PredicateExt;
use hitbox_http::predicates::header::{Header, Operation};
let predicate = Header::new(Operation::Contains(
http::header::CACHE_CONTROL,
"no-cache".to_string(),
));
let predicate = predicate.not();Modules§
- body
- Request body matching predicates.
- header
- Request header matching predicates.
- method
- HTTP method predicates for cache eligibility.
- path
- Path pattern matching predicate.
- query
- Query parameter matching predicate.
Structs§
- Body
- A predicate that matches HTTP bodies against an
Operation. - Header
- A predicate that matches HTTP headers against an
Operation. - Method
- A predicate that matches requests by HTTP method.
- Path
- A predicate that matches request paths against a pattern.
- Query
- A predicate that matches requests by query parameters.
Traits§
- Body
Predicate - Extension trait for adding body matching to a predicate chain.
- Header
Predicate - Extension trait for adding header matching to a predicate chain.
- Method
Predicate - Extension trait for adding method matching to a predicate chain.
- Path
Predicate - Extension trait for adding path matching to a predicate chain.
- Query
Predicate - Extension trait for adding query parameter matching to a predicate chain.