pub struct CacheManager { /* private fields */ }Expand description
Cache management utilities
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn with_config(
cachedir: PathBuf,
cache_size: usize,
ttl_seconds: u64,
) -> Self
pub fn with_config( cachedir: PathBuf, cache_size: usize, ttl_seconds: u64, ) -> Self
Create a new cache manager with custom settings
Sourcepub fn get(&self, key: &CacheKey) -> Result<Option<Dataset>>
pub fn get(&self, key: &CacheKey) -> Result<Option<Dataset>>
Get a dataset from cache using CacheKey
Sourcepub fn put(&self, key: &CacheKey, dataset: &Dataset) -> Result<()>
pub fn put(&self, key: &CacheKey, dataset: &Dataset) -> Result<()>
Put a dataset into cache using CacheKey
Sourcepub fn with_full_config(
cachedir: PathBuf,
cache_size: usize,
ttl_seconds: u64,
max_cache_size: u64,
offline_mode: bool,
) -> Self
pub fn with_full_config( cachedir: PathBuf, cache_size: usize, ttl_seconds: u64, max_cache_size: u64, offline_mode: bool, ) -> Self
Create a cache manager with comprehensive configuration
Sourcepub fn get_stats(&self) -> CacheStats
pub fn get_stats(&self) -> CacheStats
Get basic cache statistics
Sourcepub fn get_detailed_stats(&self) -> Result<DetailedCacheStats>
pub fn get_detailed_stats(&self) -> Result<DetailedCacheStats>
Get detailed cache statistics
Sourcepub fn set_offline_mode(&mut self, offline: bool)
pub fn set_offline_mode(&mut self, offline: bool)
Set offline mode
Sourcepub fn is_offline(&self) -> bool
pub fn is_offline(&self) -> bool
Check if in offline mode
Sourcepub fn set_max_cache_size(&mut self, max_size: u64)
pub fn set_max_cache_size(&mut self, max_size: u64)
Set maximum cache size in bytes (0 for unlimited)
Sourcepub fn max_cache_size(&self) -> u64
pub fn max_cache_size(&self) -> u64
Get maximum cache size in bytes
Sourcepub fn cleanup_old_files(&self, target_size: u64) -> Result<()>
pub fn cleanup_old_files(&self, target_size: u64) -> Result<()>
Remove old files to free up space
Sourcepub fn list_cached_files(&self) -> Result<Vec<String>>
pub fn list_cached_files(&self) -> Result<Vec<String>>
List all cached files
Sourcepub fn print_cache_report(&self) -> Result<()>
pub fn print_cache_report(&self) -> Result<()>
Print detailed cache report
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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.