Skip to main content

CachePolicy

Trait CachePolicy 

pub trait CachePolicy:
    Send
    + Sync
    + 'static {
    // Required method
    fn on_read(&self, req: &CacheReadRequest<'_>) -> CacheDecision;
}
Available on crate feature layers-cache only.
Expand description

Decide by source path whether to cache reads and how long their metadata remains fresh.

Required Methods§

fn on_read(&self, req: &CacheReadRequest<'_>) -> CacheDecision

Decide once for the reader, before any I/O.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<F> CachePolicy for F
where F: Fn(&CacheReadRequest<'_>) -> CacheDecision + Send + Sync + 'static,