Skip to main content

AdmissionPolicy

Trait AdmissionPolicy 

Source
pub trait AdmissionPolicy: Send + Sync {
    // Required method
    fn observe(&self, key: &CacheKey) -> Decision;
}
Expand description

Policy invoked after storage reports that a cache key is absent.

Required Methods§

Source

fn observe(&self, key: &CacheKey) -> Decision

Observe an absent key and return a Decision for this request.

This method runs synchronously in the asynchronous cache lookup hot path. Implementations must be fast and non-blocking, and must not panic.

Policies that retain the key beyond this call may convert it to a compact or policy-specific representation.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§