pub struct DefaultFileStatisticsCache { /* private fields */ }Expand description
Default implementation of FileStatisticsCache
Stores cached file metadata (statistics and orderings) for files.
The typical usage pattern is:
- Call
get(path)to check for cached value - If
Some(cached), validate withcached.is_valid_for(¤t_meta) - If invalid or missing, compute new value and call
put(path, new_value)
§Internal details
The memory_limit controls the maximum size of the cache, which uses a
Least Recently Used eviction algorithm. When adding a new entry, if the total
size of the cached entries exceeds memory_limit, the least recently used entries
are evicted until the total size is lower than memory_limit.
Implementations§
Trait Implementations§
Source§impl CacheAccessor<TableScopedPath, CachedFileMetadata> for DefaultFileStatisticsCache
impl CacheAccessor<TableScopedPath, CachedFileMetadata> for DefaultFileStatisticsCache
Source§fn get(&self, key: &TableScopedPath) -> Option<CachedFileMetadata>
fn get(&self, key: &TableScopedPath) -> Option<CachedFileMetadata>
Get a cached entry if it exists. Read more
Source§fn put(
&self,
key: &TableScopedPath,
value: CachedFileMetadata,
) -> Option<CachedFileMetadata>
fn put( &self, key: &TableScopedPath, value: CachedFileMetadata, ) -> Option<CachedFileMetadata>
Store a value in the cache. Read more
Source§fn remove(&self, key: &TableScopedPath) -> Option<CachedFileMetadata>
fn remove(&self, key: &TableScopedPath) -> Option<CachedFileMetadata>
Remove an entry from the cache, returning the value if it existed.
Source§fn contains_key(&self, k: &TableScopedPath) -> bool
fn contains_key(&self, k: &TableScopedPath) -> bool
Check if the cache contains a specific key.
Source§impl Default for DefaultFileStatisticsCache
impl Default for DefaultFileStatisticsCache
Source§fn default() -> DefaultFileStatisticsCache
fn default() -> DefaultFileStatisticsCache
Returns the “default value” for a type. Read more
Source§impl FileStatisticsCache for DefaultFileStatisticsCache
impl FileStatisticsCache for DefaultFileStatisticsCache
Source§fn cache_limit(&self) -> usize
fn cache_limit(&self) -> usize
Cache memory limit in bytes.
Source§fn update_cache_limit(&self, limit: usize)
fn update_cache_limit(&self, limit: usize)
Updates the cache with a new memory limit in bytes.
Source§fn list_entries(&self) -> HashMap<TableScopedPath, FileStatisticsCacheEntry>
fn list_entries(&self) -> HashMap<TableScopedPath, FileStatisticsCacheEntry>
Retrieves the information about the entries currently cached.
fn drop_table_entries(&self, table_ref: &Option<TableReference>) -> Result<()>
Auto Trait Implementations§
impl !Freeze for DefaultFileStatisticsCache
impl RefUnwindSafe for DefaultFileStatisticsCache
impl Send for DefaultFileStatisticsCache
impl Sync for DefaultFileStatisticsCache
impl Unpin for DefaultFileStatisticsCache
impl UnsafeUnpin for DefaultFileStatisticsCache
impl UnwindSafe for DefaultFileStatisticsCache
Blanket Implementations§
impl<T> Allocation for T
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> 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 more