pub struct CacheWarmingManager<B: CacheBackend + 'static> { /* private fields */ }Expand description
Cache warming manager
Implementations§
Source§impl<B: CacheBackend + 'static> CacheWarmingManager<B>
impl<B: CacheBackend + 'static> CacheWarmingManager<B>
pub fn new(backend: Arc<B>) -> Self
Sourcepub async fn register_task<T>(
&self,
task: WarmingTask,
provider: WarmingProvider<T>,
) -> CacheResult<()>
pub async fn register_task<T>( &self, task: WarmingTask, provider: WarmingProvider<T>, ) -> CacheResult<()>
Register a warming task with its data provider
Sourcepub async fn register_simple_task<T>(
&self,
task_id: String,
key: CacheKey,
provider: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = CacheResult<T>> + Send + 'static>> + Send + Sync + 'static>,
strategy: WarmingStrategy,
) -> CacheResult<()>
pub async fn register_simple_task<T>( &self, task_id: String, key: CacheKey, provider: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = CacheResult<T>> + Send + 'static>> + Send + Sync + 'static>, strategy: WarmingStrategy, ) -> CacheResult<()>
Register a simple warming task for a single key-value pair
Sourcepub async fn start_scheduler(&self) -> CacheResult<()>
pub async fn start_scheduler(&self) -> CacheResult<()>
Start the warming scheduler
Sourcepub async fn stop_scheduler(&self) -> CacheResult<()>
pub async fn stop_scheduler(&self) -> CacheResult<()>
Stop the warming scheduler
Sourcepub async fn warm_task(&self, task_id: &str) -> CacheResult<WarmingResult>
pub async fn warm_task(&self, task_id: &str) -> CacheResult<WarmingResult>
Manually trigger warming for a specific task
Sourcepub async fn warm_startup(&self) -> CacheResult<Vec<WarmingResult>>
pub async fn warm_startup(&self) -> CacheResult<Vec<WarmingResult>>
Warm on startup - execute all startup warming tasks
Sourcepub async fn get_stats(&self) -> WarmingStats
pub async fn get_stats(&self) -> WarmingStats
Get warming statistics
Sourcepub async fn list_tasks(&self) -> Vec<String>
pub async fn list_tasks(&self) -> Vec<String>
Get list of registered tasks
Sourcepub async fn remove_task(&self, task_id: &str) -> CacheResult<bool>
pub async fn remove_task(&self, task_id: &str) -> CacheResult<bool>
Remove a warming task
Trait Implementations§
Source§impl<B: CacheBackend + 'static> Drop for CacheWarmingManager<B>
impl<B: CacheBackend + 'static> Drop for CacheWarmingManager<B>
Auto Trait Implementations§
impl<B> !RefUnwindSafe for CacheWarmingManager<B>
impl<B> !UnwindSafe for CacheWarmingManager<B>
impl<B> Freeze for CacheWarmingManager<B>
impl<B> Send for CacheWarmingManager<B>
impl<B> Sync for CacheWarmingManager<B>
impl<B> Unpin for CacheWarmingManager<B>
impl<B> UnsafeUnpin for CacheWarmingManager<B>where
Arc<B>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more