pub struct TTLManager { /* private fields */ }Expand description
TTL manager for handling key expiration
Implementations§
Source§impl TTLManager
impl TTLManager
Sourcepub fn start_cleanup(
&mut self,
cleanup_callback: impl Fn(Vec<Key>) + Send + Sync + 'static,
)
pub fn start_cleanup( &mut self, cleanup_callback: impl Fn(Vec<Key>) + Send + Sync + 'static, )
Start the background cleanup task
Sourcepub fn stop_cleanup(&mut self)
pub fn stop_cleanup(&mut self)
Stop the background cleanup task
Sourcepub async fn remove_ttl(&self, key: &Key) -> KVResult<bool>
pub async fn remove_ttl(&self, key: &Key) -> KVResult<bool>
Sourcepub async fn is_expired(&self, key: &Key) -> KVResult<bool>
pub async fn is_expired(&self, key: &Key) -> KVResult<bool>
Sourcepub async fn get_expiring_keys(&self, within: Duration) -> KVResult<Vec<Key>>
pub async fn get_expiring_keys(&self, within: Duration) -> KVResult<Vec<Key>>
Get all keys that will expire within the given duration
§Errors
Returns error if duration conversion fails
Auto Trait Implementations§
impl Freeze for TTLManager
impl !RefUnwindSafe for TTLManager
impl Send for TTLManager
impl Sync for TTLManager
impl Unpin for TTLManager
impl !UnwindSafe for TTLManager
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