pub struct ServiceResolutionCache { /* private fields */ }Expand description
Service resolution cache for remote services.
Implementations§
Source§impl ServiceResolutionCache
impl ServiceResolutionCache
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty cache with a 30-second negative TTL.
Binds the production RealClock.
Sourcepub fn with_clock(clock: Arc<dyn Clock>) -> Self
pub fn with_clock(clock: Arc<dyn Clock>) -> Self
Create a cache with an injectable Clock.
Sourcepub fn set_chain_manager(&mut self, cm: Arc<ChainManager>)
pub fn set_chain_manager(&mut self, cm: Arc<ChainManager>)
Attach a chain manager for exochain audit logging.
Sourcepub fn get(&self, service_name: &str) -> Option<&ResolvedService>
pub fn get(&self, service_name: &str) -> Option<&ResolvedService>
Look up a cached service resolution (returns None if expired).
Sourcepub fn is_known_missing(&self, service_name: &str) -> bool
pub fn is_known_missing(&self, service_name: &str) -> bool
Check if a service is known-missing (negative cached).
Sourcepub fn insert(&mut self, service_name: String, resolved: ResolvedService)
pub fn insert(&mut self, service_name: String, resolved: ResolvedService)
Cache a positive resolution.
Sourcepub fn insert_negative(&mut self, service_name: String)
pub fn insert_negative(&mut self, service_name: String)
Cache a negative (not found) result.
Sourcepub fn evict_expired(&mut self)
pub fn evict_expired(&mut self)
Evict all expired entries from both positive and negative caches.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceResolutionCache
impl !UnwindSafe for ServiceResolutionCache
impl Freeze for ServiceResolutionCache
impl Send for ServiceResolutionCache
impl Sync for ServiceResolutionCache
impl Unpin for ServiceResolutionCache
impl UnsafeUnpin for ServiceResolutionCache
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more