pub struct DefaultStore<V> { /* private fields */ }Expand description
Generic store backed by HashMap<Mutex> with optional TTL eviction.
Thread-safe via Arc<Mutex<...>>. Cloning shares the same data.
Implementations§
Source§impl<V: Clone> DefaultStore<V>
impl<V: Clone> DefaultStore<V>
Sourcepub fn new(_capacity: u64, ttl_secs: u64) -> Self
pub fn new(_capacity: u64, ttl_secs: u64) -> Self
Create a new store with the given capacity hint and TTL in seconds.
ttl_secs = 0 means no expiration.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of entries (including possibly-expired ones not yet evicted).
Sourcepub fn contains_key(&self, pid: u32) -> bool
pub fn contains_key(&self, pid: u32) -> bool
Check if a PID exists and is not expired.
Trait Implementations§
Source§impl<V: Clone> Clone for DefaultStore<V>
impl<V: Clone> Clone for DefaultStore<V>
Auto Trait Implementations§
impl<V> Freeze for DefaultStore<V>
impl<V> RefUnwindSafe for DefaultStore<V>
impl<V> Send for DefaultStore<V>where
V: Send,
impl<V> Sync for DefaultStore<V>where
V: Send,
impl<V> Unpin for DefaultStore<V>
impl<V> UnsafeUnpin for DefaultStore<V>
impl<V> UnwindSafe for DefaultStore<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