pub struct DataRefreshManager { /* private fields */ }Expand description
Manages periodic data refresh for data sources.
Implementations§
Source§impl DataRefreshManager
impl DataRefreshManager
Sourcepub fn register(&mut self, key: impl Into<String>, interval_ms: u64)
pub fn register(&mut self, key: impl Into<String>, interval_ms: u64)
Register a data source for periodic refresh.
§Arguments
key- Data source identifierinterval_ms- Refresh interval in milliseconds
Sourcepub fn unregister(&mut self, key: &str)
pub fn unregister(&mut self, key: &str)
Unregister a data source.
Sourcepub fn update(&mut self, current_time_ms: u64) -> Vec<String>
pub fn update(&mut self, current_time_ms: u64) -> Vec<String>
Update the manager with the current timestamp.
Returns keys of data sources that need to be refreshed.
Sourcepub fn force_refresh(&mut self, key: &str) -> bool
pub fn force_refresh(&mut self, key: &str) -> bool
Force immediate refresh of a data source.
Sourcepub fn tasks(&self) -> &[RefreshTask]
pub fn tasks(&self) -> &[RefreshTask]
Get all registered tasks.
Sourcepub fn get_task(&self, key: &str) -> Option<&RefreshTask>
pub fn get_task(&self, key: &str) -> Option<&RefreshTask>
Get task by key.
Sourcepub fn time_until_refresh(&self, key: &str) -> Option<u64>
pub fn time_until_refresh(&self, key: &str) -> Option<u64>
Get time until next refresh for a data source (in ms).
Trait Implementations§
Source§impl Debug for DataRefreshManager
impl Debug for DataRefreshManager
Auto Trait Implementations§
impl Freeze for DataRefreshManager
impl RefUnwindSafe for DataRefreshManager
impl Send for DataRefreshManager
impl Sync for DataRefreshManager
impl Unpin for DataRefreshManager
impl UnwindSafe for DataRefreshManager
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