pub struct CacheManager { /* private fields */ }Expand description
Cache manager for hub models and repositories
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn get_repo_dir(&self, owner: &str, repo: &str, branch: &str) -> PathBuf
pub fn get_repo_dir(&self, owner: &str, repo: &str, branch: &str) -> PathBuf
Get repository directory
Sourcepub fn get_model_path(&self, repo: &str, model: &str, version: &str) -> PathBuf
pub fn get_model_path(&self, repo: &str, model: &str, version: &str) -> PathBuf
Get model cache path
Sourcepub fn is_repo_cached(&mut self, owner: &str, repo: &str, branch: &str) -> bool
pub fn is_repo_cached(&mut self, owner: &str, repo: &str, branch: &str) -> bool
Check if repository is cached
Sourcepub fn is_model_cached(
&mut self,
repo: &str,
model: &str,
version: &str,
) -> bool
pub fn is_model_cached( &mut self, repo: &str, model: &str, version: &str, ) -> bool
Check if model is cached
Sourcepub fn add_repo(
&mut self,
owner: &str,
repo: &str,
branch: &str,
size_bytes: u64,
) -> Result<()>
pub fn add_repo( &mut self, owner: &str, repo: &str, branch: &str, size_bytes: u64, ) -> Result<()>
Add repository to cache
Sourcepub fn add_model(
&mut self,
repo: &str,
model: &str,
version: &str,
hash: &str,
size_bytes: u64,
) -> Result<()>
pub fn add_model( &mut self, repo: &str, model: &str, version: &str, hash: &str, size_bytes: u64, ) -> Result<()>
Add model to cache
Sourcepub fn touch_model(
&mut self,
repo: &str,
model: &str,
version: &str,
) -> Result<()>
pub fn touch_model( &mut self, repo: &str, model: &str, version: &str, ) -> Result<()>
Update model access time
Sourcepub fn get_cache_stats(&self) -> CacheStats
pub fn get_cache_stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn cleanup_cache(
&mut self,
max_size_bytes: u64,
max_age_days: u32,
) -> Result<CacheCleanupResult>
pub fn cleanup_cache( &mut self, max_size_bytes: u64, max_age_days: u32, ) -> Result<CacheCleanupResult>
Perform cache cleanup based on size and age limits
Sourcepub fn compress_cache(&mut self) -> Result<CompressionResult>
pub fn compress_cache(&mut self) -> Result<CompressionResult>
Compress cache files to save disk space
Sourcepub fn validate_cache(&self) -> Result<CacheValidationResult>
pub fn validate_cache(&self) -> Result<CacheValidationResult>
Validate cache integrity
Sourcepub fn get_cache_size(&self) -> u64
pub fn get_cache_size(&self) -> u64
Get cache size
Sourcepub fn clean_cache(
&mut self,
max_size_bytes: Option<u64>,
max_age_days: Option<u64>,
) -> Result<()>
pub fn clean_cache( &mut self, max_size_bytes: Option<u64>, max_age_days: Option<u64>, ) -> Result<()>
Clean old cache entries
Sourcepub fn clear_cache(&mut self) -> Result<()>
pub fn clear_cache(&mut self) -> Result<()>
Clear entire cache
Trait Implementations§
Source§impl Clone for CacheManager
impl Clone for CacheManager
Source§fn clone(&self) -> CacheManager
fn clone(&self) -> CacheManager
Returns a duplicate of the value. Read more
1.0.0 · 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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