pub struct RouteCache { /* private fields */ }cache only.Expand description
LRU cache for route resolution results.
Maintains separate parent and child caches, each with independent LRU eviction. Default capacity is 1000 entries per cache.
The cache is automatically cleared on route registration and navigation to ensure consistency.
Implementations§
Source§impl RouteCache
impl RouteCache
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn get_parent(&mut self, path: &str) -> Option<RouteId>
pub fn get_parent(&mut self, path: &str) -> Option<RouteId>
Look up the cached parent RouteId for the given path.
Returns None on a cache miss. Updates hit/miss stats.
Sourcepub fn set_parent(&mut self, path: String, parent_route_id: RouteId)
pub fn set_parent(&mut self, path: String, parent_route_id: RouteId)
Insert a parent route mapping into the cache.
Sourcepub fn get_child(
&mut self,
path: &str,
outlet_name: Option<&str>,
) -> Option<RouteParams>
pub fn get_child( &mut self, path: &str, outlet_name: Option<&str>, ) -> Option<RouteParams>
Look up the cached child RouteParams for the given path and outlet name.
Returns None on a cache miss. Updates hit/miss stats.
Sourcepub fn set_child(
&mut self,
path: String,
outlet_name: Option<String>,
params: RouteParams,
)
pub fn set_child( &mut self, path: String, outlet_name: Option<String>, params: RouteParams, )
Insert a child route params mapping into the cache.
Sourcepub const fn stats(&self) -> &CacheStats
pub const fn stats(&self) -> &CacheStats
Return a reference to the current cache statistics.
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Reset all counters in CacheStats to zero.
Sourcepub fn parent_cache_size(&self) -> usize
pub fn parent_cache_size(&self) -> usize
Return the number of entries currently in the parent cache.
Sourcepub fn child_cache_size(&self) -> usize
pub fn child_cache_size(&self) -> usize
Return the number of entries currently in the child cache.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Return the total number of entries across both sub-caches.
Trait Implementations§
Source§impl Clone for RouteCache
impl Clone for RouteCache
Source§impl Debug for RouteCache
impl Debug for RouteCache
Auto Trait Implementations§
impl Freeze for RouteCache
impl RefUnwindSafe for RouteCache
impl Send for RouteCache
impl Sync for RouteCache
impl Unpin for RouteCache
impl UnwindSafe for RouteCache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().