pub struct CacheManager { /* private fields */ }Expand description
Manages local document caching
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn with_dir(cache_dir: PathBuf) -> Result<Self>
pub fn with_dir(cache_dir: PathBuf) -> Result<Self>
Create a cache manager with a custom directory
Sourcepub fn default_cache_dir() -> Result<PathBuf>
pub fn default_cache_dir() -> Result<PathBuf>
Get the default cache directory
Sourcepub fn get_document(&self, doc: &DocumentType, format: Format) -> Option<String>
pub fn get_document(&self, doc: &DocumentType, format: Format) -> Option<String>
Get cached document content
Sourcepub fn store_document(
&self,
doc: &DocumentType,
format: Format,
content: &str,
) -> Result<()>
pub fn store_document( &self, doc: &DocumentType, format: Format, content: &str, ) -> Result<()>
Store document content in cache
Sourcepub fn clear_cache(&self) -> Result<()>
pub fn clear_cache(&self) -> Result<()>
Clear all cached documents
Sourcepub fn remove(&self, doc: &DocumentType) -> Result<bool>
pub fn remove(&self, doc: &DocumentType) -> Result<bool>
Remove a specific document from cache Removes document content and associated metadata Returns true if the document was found and removed
Sourcepub fn list_cached(&self) -> Vec<DocumentType>
pub fn list_cached(&self) -> Vec<DocumentType>
List all cached documents
Sourcepub fn get_metadata(&self, doc: &DocumentType) -> Option<CacheMetadata>
pub fn get_metadata(&self, doc: &DocumentType) -> Option<CacheMetadata>
Get cached metadata for a document
Sourcepub fn store_metadata(
&self,
doc: &DocumentType,
meta: &CacheMetadata,
) -> Result<()>
pub fn store_metadata( &self, doc: &DocumentType, meta: &CacheMetadata, ) -> Result<()>
Store metadata for a document
Sourcepub fn list_cached_with_metadata(&self) -> Vec<CachedDocument>
pub fn list_cached_with_metadata(&self) -> Vec<CachedDocument>
List cached documents with their metadata
Auto Trait Implementations§
impl Freeze for CacheManager
impl RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin for CacheManager
impl UnsafeUnpin for CacheManager
impl UnwindSafe for CacheManager
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