pub struct CacheStats {
pub size: usize,
pub capacity: usize,
pub hits: u64,
pub misses: u64,
pub frontmatter_cache_size: usize,
pub tera_cache_size: usize,
}Expand description
Cache statistics
QUICK WIN 3 + OPTIMIZATION 3: Enhanced with hit/miss tracking and additional cache sizes
Provides information about the current state of a template cache.
§Examples
use crate::template_cache::{TemplateCache, CacheStats};
let cache = TemplateCache::new(5000);
let stats = cache.stats()?;
println!("Cache size: {}/{}", stats.size, stats.capacity);
println!("Hit rate: {:.1}%", stats.hit_rate());
println!("Total accesses: {}", stats.total_accesses());
println!("Frontmatter cache: {}", stats.frontmatter_cache_size);
println!("Tera cache: {}", stats.tera_cache_size);Fields§
§size: usize§capacity: usize§hits: u64QUICK WIN 3: Number of cache hits
misses: u64QUICK WIN 3: Number of cache misses
frontmatter_cache_size: usizeOPTIMIZATION 3.1: Number of cached frontmatter entries
tera_cache_size: usizeOPTIMIZATION 3.2: Number of cached Tera template strings
Implementations§
Source§impl CacheStats
impl CacheStats
Trait Implementations§
Source§impl Clone for CacheStats
impl Clone for CacheStats
Source§fn clone(&self) -> CacheStats
fn clone(&self) -> CacheStats
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CacheStats
impl RefUnwindSafe for CacheStats
impl Send for CacheStats
impl Sync for CacheStats
impl Unpin for CacheStats
impl UnsafeUnpin for CacheStats
impl UnwindSafe for CacheStats
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EvidenceKind for T
impl<T> EvidenceKind for T
default fn kind_label(&self) -> &'static str
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