pub struct LiquidCache { /* private fields */ }Expand description
The main cache structure.
Implementations§
Source§impl LiquidCache
impl LiquidCache
Sourcepub fn compute_memory_usage_bytes(&self) -> u64
pub fn compute_memory_usage_bytes(&self) -> u64
Get the memory usage of the cache in bytes.
Sourcepub fn write_stats(
&self,
parquet_file_path: impl AsRef<Path>,
) -> Result<(), ParquetError>
pub fn write_stats( &self, parquet_file_path: impl AsRef<Path>, ) -> Result<(), ParquetError>
Write the stats of the cache to a parquet file.
Source§impl LiquidCache
impl LiquidCache
Sourcepub fn new(
batch_size: usize,
max_cache_bytes: usize,
cache_dir: PathBuf,
cache_policy: Box<dyn CachePolicy>,
squeeze_policy: Box<dyn SqueezePolicy>,
io_mode: IoMode,
) -> Self
pub fn new( batch_size: usize, max_cache_bytes: usize, cache_dir: PathBuf, cache_policy: Box<dyn CachePolicy>, squeeze_policy: Box<dyn SqueezePolicy>, io_mode: IoMode, ) -> Self
Create a new cache
Sourcepub fn register_or_get_file(&self, file_path: String) -> Arc<LiquidCachedFile>
pub fn register_or_get_file(&self, file_path: String) -> Arc<LiquidCachedFile>
Register a file in the cache.
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Get the batch size of the cache.
Sourcepub fn max_cache_bytes(&self) -> usize
pub fn max_cache_bytes(&self) -> usize
Get the max cache bytes of the cache.
Sourcepub fn memory_usage_bytes(&self) -> usize
pub fn memory_usage_bytes(&self) -> usize
Get the memory usage of the cache in bytes.
Sourcepub fn disk_usage_bytes(&self) -> usize
pub fn disk_usage_bytes(&self) -> usize
Get the disk usage of the cache in bytes.
Sourcepub fn flush_trace(&self, to_file: impl AsRef<Path>)
pub fn flush_trace(&self, to_file: impl AsRef<Path>)
Flush the cache trace to a file.
Sourcepub fn enable_trace(&self)
pub fn enable_trace(&self)
Enable the cache trace.
Sourcepub fn disable_trace(&self)
pub fn disable_trace(&self)
Disable the cache trace.
Sourcepub unsafe fn reset(&self)
pub unsafe fn reset(&self)
Reset the cache.
§Safety
This is unsafe because resetting the cache while other threads are using the cache may cause undefined behavior. You should only call this when no one else is using the cache.
Sourcepub fn flush_data(&self)
pub fn flush_data(&self)
Flush all memory-based entries to disk while preserving their format. Arrow entries become DiskArrow, Liquid entries become DiskLiquid. Entries already on disk are left unchanged.
This is for admin use only. This has no guarantees that some new entry will not be inserted in the meantime, or some entries are promoted to memory again. You mostly want to use this when no one else is using the cache.
Sourcepub fn storage(&self) -> &Arc<CacheStorage>
pub fn storage(&self) -> &Arc<CacheStorage>
Get the storage of the cache.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LiquidCache
impl !RefUnwindSafe for LiquidCache
impl Send for LiquidCache
impl Sync for LiquidCache
impl Unpin for LiquidCache
impl !UnwindSafe for LiquidCache
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
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>
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>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request