pub struct ResolutionCache { /* private fields */ }Expand description
Service resolution cache for frequently accessed services
Caches resolved service instances to avoid repeated resolution overhead. Particularly beneficial for complex dependency graphs with deep nesting.
Implementations§
Source§impl ResolutionCache
impl ResolutionCache
Sourcepub fn with_config(config: CacheConfig) -> Self
pub fn with_config(config: CacheConfig) -> Self
Create a new resolution cache with custom configuration
Sourcepub fn get(&self, key: &Key) -> Option<Arc<dyn Any + Send + Sync>>
pub fn get(&self, key: &Key) -> Option<Arc<dyn Any + Send + Sync>>
Get a service from the cache
Sourcepub fn put(&self, key: Key, service: Arc<dyn Any + Send + Sync>) -> DiResult<()>
pub fn put(&self, key: Key, service: Arc<dyn Any + Send + Sync>) -> DiResult<()>
Put a service into the cache
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl Debug for ResolutionCache
impl Debug for ResolutionCache
Auto Trait Implementations§
impl !Freeze for ResolutionCache
impl RefUnwindSafe for ResolutionCache
impl Send for ResolutionCache
impl Sync for ResolutionCache
impl Unpin for ResolutionCache
impl UnsafeUnpin for ResolutionCache
impl UnwindSafe for ResolutionCache
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