Skip to main content

CacheWarmer

Trait CacheWarmer 

Source
pub trait CacheWarmer: Send + Sync {
    // Required methods
    fn warm<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task: &'life1 WarmingTask,
    ) -> Pin<Box<dyn Future<Output = CacheResult<WarmingResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn should_warm<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task: &'life1 WarmingTask,
    ) -> Pin<Box<dyn Future<Output = CacheResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_warming_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = CacheResult<WarmingStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Cache warmer trait for implementing custom warming logic

Required Methods§

Source

fn warm<'life0, 'life1, 'async_trait>( &'life0 self, task: &'life1 WarmingTask, ) -> Pin<Box<dyn Future<Output = CacheResult<WarmingResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute warming for a specific task

Source

fn should_warm<'life0, 'life1, 'async_trait>( &'life0 self, task: &'life1 WarmingTask, ) -> Pin<Box<dyn Future<Output = CacheResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if warming should be triggered based on the strategy

Source

fn get_warming_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CacheResult<WarmingStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get cache statistics for warming decisions

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§