Expand description
Background task offloading for stale-while-revalidate.
When using the OffloadRevalidate stale policy, expired cache entries are served
immediately while fresh data is fetched in the background. This module provides
the OffloadManager for handling these background tasks.
Offload manager for background task execution.
This module provides infrastructure for offloading tasks to background execution, primarily used for Stale-While-Revalidate (SWR) cache pattern where stale data is returned immediately while cache revalidation happens asynchronously.
§Example
ⓘ
use hitbox::offload::{OffloadManager, OffloadConfig};
let config = OffloadConfig::default();
let manager = OffloadManager::new(config);
// Spawn a background task
manager.spawn(async {
// Revalidation logic here
});Structs§
- Offload
Config - Configuration for the OffloadManager.
- Offload
Config Builder - Builder for OffloadConfig.
- Offload
Handle - Handle to a spawned offload task.
- Offload
Manager - Manager for offloading tasks to background execution.
- SmolStr
- A
SmolStris a string type that has the following properties:
Enums§
- Offload
Key - Key for identifying offloaded tasks.
- Timeout
Policy - Policy for handling task timeouts.