pub struct ShardedMemo<K, V> { /* private fields */ }Expand description
Memo map split into independently locked shards.
A processed context is shared across threads — a server caches one and hands a clone to every request — so its memos see concurrent lookups. With a single lock every lookup serialises; here a key’s hash picks one of sixteen shards, so lookups of different keys rarely meet on the same lock.
The key is hashed once per operation: the same hash selects the shard and probes that shard’s table.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<K, V> !Freeze for ShardedMemo<K, V>
impl<K, V> !RefUnwindSafe for ShardedMemo<K, V>
impl<K, V> Send for ShardedMemo<K, V>
impl<K, V> Sync for ShardedMemo<K, V>
impl<K, V> Unpin for ShardedMemo<K, V>
impl<K, V> UnsafeUnpin for ShardedMemo<K, V>
impl<K, V> UnwindSafe for ShardedMemo<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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Views this value as an
Unordered reference.