pub trait CacheablePredictor {
// Required methods
fn cacheable_prediction(&self, key: &CacheKey) -> bool;
fn mark_cacheable(&self, key: &CacheKey) -> bool;
fn mark_uncacheable(
&self,
key: &CacheKey,
reason: NoCacheReason,
) -> Option<bool>;
}
Expand description
The cache predictor trait.
This trait allows user defined predictor to replace Predictor.
Required Methods§
Sourcefn cacheable_prediction(&self, key: &CacheKey) -> bool
fn cacheable_prediction(&self, key: &CacheKey) -> bool
Return true if likely cacheable, false if likely not.
Sourcefn mark_cacheable(&self, key: &CacheKey) -> bool
fn mark_cacheable(&self, key: &CacheKey) -> bool
Mark cacheable to allow next request to cache. Returns false if the key was already marked cacheable.
Sourcefn mark_uncacheable(
&self,
key: &CacheKey,
reason: NoCacheReason,
) -> Option<bool>
fn mark_uncacheable( &self, key: &CacheKey, reason: NoCacheReason, ) -> Option<bool>
Mark uncacheable to actively bypass cache on the next request. May skip marking on certain NoCacheReasons. Returns None if we skipped marking uncacheable. Returns Some(false) if the key was already marked uncacheable.