pub struct LiquidCache { /* private fields */ }Expand description
Cache storage for liquid cache.
Example (async read):
use liquid_cache::cache::{LiquidCacheBuilder, EntryID};
use arrow::array::UInt64Array;
use std::sync::Arc;
tokio_test::block_on(async {
let storage = LiquidCacheBuilder::new().build();
let entry_id = EntryID::from(0);
let arrow_array = Arc::new(UInt64Array::from_iter_values(0..32));
storage.insert(entry_id, arrow_array.clone()).await;
// Get the arrow array back asynchronously
let retrieved = storage.get(&entry_id).await.unwrap();
assert_eq!(retrieved.as_ref(), arrow_array.as_ref());
});Implementations§
Source§impl LiquidCache
Builder returned by LiquidCache::insert for configuring cache writes.
impl LiquidCache
Builder returned by LiquidCache::insert for configuring cache writes.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Return current cache statistics: counts and resource usage.
Sourcepub fn insert<'a>(
self: &'a Arc<Self>,
entry_id: EntryID,
batch_to_cache: ArrayRef,
) -> Insert<'a>
pub fn insert<'a>( self: &'a Arc<Self>, entry_id: EntryID, batch_to_cache: ArrayRef, ) -> Insert<'a>
Insert a batch into the cache.
Sourcepub fn get<'a>(&'a self, entry_id: &'a EntryID) -> Get<'a>
pub fn get<'a>(&'a self, entry_id: &'a EntryID) -> Get<'a>
Create a Get builder for the provided entry.
Sourcepub fn eval_predicate<'a>(
&'a self,
entry_id: &'a EntryID,
predicate: &'a Arc<dyn PhysicalExpr>,
) -> EvaluatePredicate<'a>
pub fn eval_predicate<'a>( &'a self, entry_id: &'a EntryID, predicate: &'a Arc<dyn PhysicalExpr>, ) -> EvaluatePredicate<'a>
Create an EvaluatePredicate builder for evaluating predicates on cached data.
Sourcepub async fn try_read_liquid(
&self,
entry_id: &EntryID,
) -> Option<LiquidArrayRef>
pub async fn try_read_liquid( &self, entry_id: &EntryID, ) -> Option<LiquidArrayRef>
Try to read a liquid array from the cache. Returns None if the cached data is not in liquid format.
Sourcepub fn for_each_entry(&self, f: impl FnMut(&EntryID, &CacheEntry))
pub fn for_each_entry(&self, f: impl FnMut(&EntryID, &CacheEntry))
Iterate over all entries in the cache. No guarantees are made about the order of the entries. Isolation level: read-committed
Sourcepub fn observer(&self) -> &Observer
pub fn observer(&self) -> &Observer
Access the cache observer (runtime stats, debug event trace, and optional cache tracing).
Sourcepub fn compressor_states(
&self,
entry_id: &EntryID,
) -> Arc<LiquidCompressorStates>
pub fn compressor_states( &self, entry_id: &EntryID, ) -> Arc<LiquidCompressorStates>
Get the compressor states of the cache.
Sourcepub fn add_squeeze_hint(
&self,
entry_id: &EntryID,
expression: Arc<CacheExpression>,
)
pub fn add_squeeze_hint( &self, entry_id: &EntryID, expression: Arc<CacheExpression>, )
Add a squeeze hint for an entry.
Sourcepub async fn flush_all_to_disk(&self)
pub async fn flush_all_to_disk(&self)
Flush all entries to disk.
Source§impl LiquidCache
impl LiquidCache
Sourcepub fn consume_event_trace(&self) -> EventTrace
pub fn consume_event_trace(&self) -> EventTrace
Consume the trace of the cache, for testing only.
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 UnsafeUnpin 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