pub trait CacheConfig<Req, Res> {
type RequestPredicate: Predicate<Subject = Req> + Send + Sync + 'static;
type ResponsePredicate: Predicate<Subject = Res> + Send + Sync + 'static;
type Extractor: Extractor<Subject = Req> + Send + Sync + 'static;
// Required methods
fn request_predicates(&self) -> Self::RequestPredicate;
fn response_predicates(&self) -> Self::ResponsePredicate;
fn extractors(&self) -> Self::Extractor;
fn policy(&self) -> &PolicyConfig;
}Expand description
Trait for cache configuration.
Provides predicates for determining cacheability, extractors for generating cache keys, and policy for TTL/staleness behavior.
Required Associated Types§
Sourcetype RequestPredicate: Predicate<Subject = Req> + Send + Sync + 'static
type RequestPredicate: Predicate<Subject = Req> + Send + Sync + 'static
Predicate type for filtering requests.
Sourcetype ResponsePredicate: Predicate<Subject = Res> + Send + Sync + 'static
type ResponsePredicate: Predicate<Subject = Res> + Send + Sync + 'static
Predicate type for filtering responses.
Required Methods§
Sourcefn request_predicates(&self) -> Self::RequestPredicate
fn request_predicates(&self) -> Self::RequestPredicate
Returns predicates that decide if a request should be cached.
Sourcefn response_predicates(&self) -> Self::ResponsePredicate
fn response_predicates(&self) -> Self::ResponsePredicate
Returns predicates that decide if a response should be cached.
Sourcefn extractors(&self) -> Self::Extractor
fn extractors(&self) -> Self::Extractor
Returns extractors that generate cache keys from requests.
Sourcefn policy(&self) -> &PolicyConfig
fn policy(&self) -> &PolicyConfig
Returns TTL and behavior policy for cached entries.