CacheManager

Struct CacheManager 

Source
pub struct CacheManager { /* private fields */ }
Expand description

Manager for cached DuckDB databases

Implementations§

Source§

impl CacheManager

Source

pub fn new() -> Result<Self>

Create a new cache manager with the default cache directory

Source

pub fn with_dir(cache_dir: PathBuf) -> Result<Self>

Create a cache manager with a custom cache directory

Source

pub fn default_cache_dir() -> Result<PathBuf>

Get the default cache directory

Source

pub fn compute_cache_key(dump_path: &Path) -> Result<String>

Compute the cache key for a dump file

Source

pub fn cache_path(&self, cache_key: &str) -> PathBuf

Get the path where a cached database would be stored

Source

pub fn has_valid_cache(&self, dump_path: &Path) -> Result<bool>

Check if a valid cache exists for a dump file

Source

pub fn get_cache(&self, dump_path: &Path) -> Result<Option<PathBuf>>

Get the cache path for a dump file, if a valid cache exists

Source

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

Source

pub fn load_index(&self) -> Result<CacheIndex>

Load the cache index

Source

pub fn list_entries(&self) -> Result<Vec<CacheEntry>>

List all cache entries

Source

pub fn remove_cache(&self, cache_key: &str) -> Result<()>

Remove a specific cache entry

Source

pub fn clear_all(&self) -> Result<usize>

Clear all cached databases

Source

pub fn total_size(&self) -> Result<u64>

Get total cache size in bytes

Source

pub fn cache_dir(&self) -> &Path

Get the cache directory path

Trait Implementations§

Source§

impl Default for CacheManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,