pub struct ManagerBuilder<C, const N: usize> { /* private fields */ }Expand description
Builder for Manager.
§Required
weight_limit— maximum total weight before evictioneviction_cb— callback invoked for each evicted(key, weight)pairshutdown— watch receiver that signals actors to stop
§Example
ⓘ
let manager = Manager::<32>::builder(limit, eviction_cb, shutdown_rx, runtime_handle)
.capacity(10_000)
.build();Implementations§
Source§impl<C, const N: usize> ManagerBuilder<C, N>where
C: AsyncEvictionCallback<CacheEntryKey>,
impl<C, const N: usize> ManagerBuilder<C, N>where
C: AsyncEvictionCallback<CacheEntryKey>,
Sourcepub fn capacity(self, capacity: usize) -> Self
pub fn capacity(self, capacity: usize) -> Self
Set the estimated per-shard capacity for preallocation.
Sourcepub fn len_watermark(self, watermark: usize) -> Self
pub fn len_watermark(self, watermark: usize) -> Self
Set an optional item-count watermark.
Sourcepub fn num_eviction_workers(self, n: usize) -> Self
pub fn num_eviction_workers(self, n: usize) -> Self
Set the number of concurrent eviction worker tasks.
Defaults to N (one per shard).
Auto Trait Implementations§
impl<C, const N: usize> Freeze for ManagerBuilder<C, N>
impl<C, const N: usize> RefUnwindSafe for ManagerBuilder<C, N>where
Arc<C>: RefUnwindSafe,
impl<C, const N: usize> Send for ManagerBuilder<C, N>
impl<C, const N: usize> Sync for ManagerBuilder<C, N>
impl<C, const N: usize> Unpin for ManagerBuilder<C, N>
impl<C, const N: usize> UnsafeUnpin for ManagerBuilder<C, N>where
Arc<C>: UnsafeUnpin,
impl<C, const N: usize> UnwindSafe for ManagerBuilder<C, N>where
Arc<C>: UnwindSafe,
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