pub struct CacheManager { /* private fields */ }Expand description
Manager for cached DuckDB databases
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 cache directory
Sourcepub fn default_cache_dir() -> Result<PathBuf>
pub fn default_cache_dir() -> Result<PathBuf>
Get the default cache directory
Sourcepub fn compute_cache_key(dump_path: &Path) -> Result<String>
pub fn compute_cache_key(dump_path: &Path) -> Result<String>
Compute the cache key for a dump file
Sourcepub fn cache_path(&self, cache_key: &str) -> PathBuf
pub fn cache_path(&self, cache_key: &str) -> PathBuf
Get the path where a cached database would be stored
Sourcepub fn has_valid_cache(&self, dump_path: &Path) -> Result<bool>
pub fn has_valid_cache(&self, dump_path: &Path) -> Result<bool>
Check if a valid cache exists for a dump file
Sourcepub fn get_cache(&self, dump_path: &Path) -> Result<Option<PathBuf>>
pub fn get_cache(&self, dump_path: &Path) -> Result<Option<PathBuf>>
Get the cache path for a dump file, if a valid cache exists
Sourcepub fn create_cache(
&self,
dump_path: &Path,
table_count: usize,
row_count: u64,
) -> Result<PathBuf>
pub fn create_cache( &self, dump_path: &Path, table_count: usize, row_count: u64, ) -> Result<PathBuf>
Create a new cache entry for a dump file
Sourcepub fn load_index(&self) -> Result<CacheIndex>
pub fn load_index(&self) -> Result<CacheIndex>
Load the cache index
Sourcepub fn list_entries(&self) -> Result<Vec<CacheEntry>>
pub fn list_entries(&self) -> Result<Vec<CacheEntry>>
List all cache entries
Sourcepub fn remove_cache(&self, cache_key: &str) -> Result<()>
pub fn remove_cache(&self, cache_key: &str) -> Result<()>
Remove a specific cache entry
Sourcepub fn total_size(&self) -> Result<u64>
pub fn total_size(&self) -> Result<u64>
Get total cache size in bytes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CacheManager
impl RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin 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