pub struct Manager<K, V>{ /* private fields */ }Expand description
Manages per-key accumulators and TTL cleanup.
Implementations§
Source§impl<K, V> Manager<K, V>
impl<K, V> Manager<K, V>
Sourcepub fn new(
config: AccumulatorConfig<V>,
store_factory: impl Fn() -> Box<dyn Store<V>> + Send + Sync + 'static,
) -> Self
pub fn new( config: AccumulatorConfig<V>, store_factory: impl Fn() -> Box<dyn Store<V>> + Send + Sync + 'static, ) -> Self
Create a new keyed manager.
Sourcepub fn get_or_create(&self, key: K) -> Arc<Accumulator<V>> ⓘ
pub fn get_or_create(&self, key: K) -> Arc<Accumulator<V>> ⓘ
Get the accumulator for key, creating it when missing.
Sourcepub fn append(&self, key: K, value: V) -> AppResult<Option<Vec<V>>>
pub fn append(&self, key: K, value: V) -> AppResult<Option<Vec<V>>>
Append a value to the keyed accumulator.
Sourcepub fn cleanup_expired(&self) -> AppResult<Vec<K>>
pub fn cleanup_expired(&self) -> AppResult<Vec<K>>
Remove expired accumulators and return the removed keys.
Auto Trait Implementations§
impl<K, V> !Freeze for Manager<K, V>
impl<K, V> !RefUnwindSafe for Manager<K, V>
impl<K, V> !UnwindSafe for Manager<K, V>
impl<K, V> Send for Manager<K, V>where
K: Send,
impl<K, V> Sync for Manager<K, V>where
K: Send,
impl<K, V> Unpin for Manager<K, V>where
K: Unpin,
impl<K, V> UnsafeUnpin for Manager<K, V>
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