pub trait ConcurrencyManager<Res>: Send + Syncwhere
Res: CacheableResponse,{
// Required methods
fn check(
&self,
cache_key: &CacheKey,
concurrency: BoundedU8<1, u8::MAX>,
) -> ConcurrencyDecision<Res>;
fn resolve(
&self,
cache_key: &CacheKey,
cache_value: &CacheValue<<Res as CacheableResponse>::Cached>,
);
fn cleanup(&self, cache_key: &CacheKey);
}Expand description
Trait for managing concurrent requests to prevent dogpile effect
Required Methods§
Sourcefn check(
&self,
cache_key: &CacheKey,
concurrency: BoundedU8<1, u8::MAX>,
) -> ConcurrencyDecision<Res>
fn check( &self, cache_key: &CacheKey, concurrency: BoundedU8<1, u8::MAX>, ) -> ConcurrencyDecision<Res>
Check if this request should proceed to upstream or await an existing request
Sourcefn resolve(
&self,
cache_key: &CacheKey,
cache_value: &CacheValue<<Res as CacheableResponse>::Cached>,
)
fn resolve( &self, cache_key: &CacheKey, cache_value: &CacheValue<<Res as CacheableResponse>::Cached>, )
Notify waiting requests that the response is ready and return it back