pub struct ResolveCache { /* private fields */ }Expand description
Process-lifetime LRU of StrHash → resolved string, shared by all queries
on a compute node.
Uses StrHashIdentityBuildHasher — bucket selection is the hash’s upper
64 bits, no second SipHash — and enforces two budgets: Self::insert
evicts least-recently-used entries until both the entry count (enforced by
the LRU itself) and the byte budget hold. Cumulative hit/miss counters are
reported in the phases: debug line.
Implementations§
Source§impl ResolveCache
impl ResolveCache
Sourcepub fn from_env() -> Arc<Self>
pub fn from_env() -> Arc<Self>
Engine-wide cache with the env-tunable entry capacity
(WARATAH_RESOLVE_CACHE_ENTRIES, KiB-style plain count; 0 disables)
and the default byte budget.
Sourcepub fn new(capacity_entries: usize, byte_budget: usize) -> Self
pub fn new(capacity_entries: usize, byte_budget: usize) -> Self
Cache holding at most capacity_entries strings and byte_budget
summed string bytes. capacity_entries == 0 disables the cache:
every lookup misses and inserts are dropped.
Sourcepub fn probe(&self, hashes: &[StrHash]) -> (StrHashMap, Vec<StrHash>)
pub fn probe(&self, hashes: &[StrHash]) -> (StrHashMap, Vec<StrHash>)
Probe hashes; returns cache hits as a map plus the ordered miss list
(order-preserving, so registry-bound batches keep their sorted walk).
Hits refresh their LRU recency; both counters accumulate.
Sourcepub fn insert(&self, pairs: impl IntoIterator<Item = (StrHash, String)>)
pub fn insert(&self, pairs: impl IntoIterator<Item = (StrHash, String)>)
Insert resolved strings, evicting least-recently-used entries until
the byte budget holds. Unregistered hashes (None from the registry)
are skipped by the caller.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ResolveCache
impl RefUnwindSafe for ResolveCache
impl Send for ResolveCache
impl Sync for ResolveCache
impl Unpin for ResolveCache
impl UnsafeUnpin for ResolveCache
impl UnwindSafe for ResolveCache
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].