pub struct TemplateCache { /* private fields */ }Expand description
Template cache with file change detection
Implementations§
Source§impl TemplateCache
impl TemplateCache
Sourcepub fn get(&mut self, key: &str) -> Option<ParsedTemplate>
pub fn get(&mut self, key: &str) -> Option<ParsedTemplate>
Sourcepub fn insert(&mut self, key: String, template: ParsedTemplate)
pub fn insert(&mut self, key: String, template: ParsedTemplate)
Sourcepub fn insert_with_file(
&mut self,
key: String,
template: ParsedTemplate,
file_path: Option<PathBuf>,
)
pub fn insert_with_file( &mut self, key: String, template: ParsedTemplate, file_path: Option<PathBuf>, )
Insert a template into the cache with file path for change detection
§Arguments
key- Cache keytemplate- Parsed template to cachefile_path- Path to the template file (for change detection)
Sourcepub fn remove(&mut self, key: &str) -> Option<ParsedTemplate>
pub fn remove(&mut self, key: &str) -> Option<ParsedTemplate>
Remove a template from the cache
Sourcepub fn invalidate_file(&mut self, file_path: &Path)
pub fn invalidate_file(&mut self, file_path: &Path)
Invalidate cache entries for a specific file
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TemplateCache
impl RefUnwindSafe for TemplateCache
impl Send for TemplateCache
impl Sync for TemplateCache
impl Unpin for TemplateCache
impl UnwindSafe for TemplateCache
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