pub struct DefaultListFilesCache { /* private fields */ }Expand description
Default implementation of ListFilesCache
Caches file metadata for file listing operations.
§Internal details
The memory_limit parameter controls the maximum size of the cache, which uses a Least
Recently Used eviction algorithm. When adding a new entry, if the total number of entries in
the cache exceeds memory_limit, the least recently used entries are evicted until the total
size is lower than the memory_limit.
§Extra Handling
Users should use the Self::get and Self::put methods. The
Self::get_with_extra and Self::put_with_extra methods simply call
get and put, respectively.
Implementations§
Source§impl DefaultListFilesCache
impl DefaultListFilesCache
Sourcepub fn new(memory_limit: usize, ttl: Option<Duration>) -> Self
pub fn new(memory_limit: usize, ttl: Option<Duration>) -> Self
Creates a new instance of DefaultListFilesCache.
§Arguments
memory_limit- The maximum size of the cache, in bytes.ttl- The TTL (time-to-live) of entries in the cache.
Sourcepub fn cache_limit(&self) -> usize
pub fn cache_limit(&self) -> usize
Returns the cache’s memory limit in bytes.
Sourcepub fn update_cache_limit(&self, limit: usize)
pub fn update_cache_limit(&self, limit: usize)
Updates the cache with a new memory limit in bytes.
Trait Implementations§
Source§impl CacheAccessor<TableScopedPath, Arc<Vec<ObjectMeta>>> for DefaultListFilesCache
impl CacheAccessor<TableScopedPath, Arc<Vec<ObjectMeta>>> for DefaultListFilesCache
Source§fn get(&self, k: &TableScopedPath) -> Option<Arc<Vec<ObjectMeta>>>
fn get(&self, k: &TableScopedPath) -> Option<Arc<Vec<ObjectMeta>>>
Gets all files for the given table base path.
This is equivalent to calling get_with_extra(k, &None).
Source§fn get_with_extra(
&self,
table_scoped_path: &TableScopedPath,
prefix: &Self::Extra,
) -> Option<Arc<Vec<ObjectMeta>>>
fn get_with_extra( &self, table_scoped_path: &TableScopedPath, prefix: &Self::Extra, ) -> Option<Arc<Vec<ObjectMeta>>>
Performs a prefix-aware cache lookup.
§Arguments
table_base- The table’s base path (the cache key)prefix- Optional prefix filter (relative to table base) for partition filtering
§Behavior
- Fetches the cache entry for
table_base - If
prefixisSome, filters results to only files matchingtable_base/prefix - Returns the (potentially filtered) results
This enables efficient partition pruning - a single cached listing of the full table can serve queries for any partition subset without additional storage calls.
type Extra = Option<Path>
Source§fn put(
&self,
key: &TableScopedPath,
value: Arc<Vec<ObjectMeta>>,
) -> Option<Arc<Vec<ObjectMeta>>>
fn put( &self, key: &TableScopedPath, value: Arc<Vec<ObjectMeta>>, ) -> Option<Arc<Vec<ObjectMeta>>>
Source§fn put_with_extra(
&self,
key: &TableScopedPath,
value: Arc<Vec<ObjectMeta>>,
_e: &Self::Extra,
) -> Option<Arc<Vec<ObjectMeta>>>
fn put_with_extra( &self, key: &TableScopedPath, value: Arc<Vec<ObjectMeta>>, _e: &Self::Extra, ) -> Option<Arc<Vec<ObjectMeta>>>
Source§fn remove(&self, k: &TableScopedPath) -> Option<Arc<Vec<ObjectMeta>>>
fn remove(&self, k: &TableScopedPath) -> Option<Arc<Vec<ObjectMeta>>>
Source§fn contains_key(&self, k: &TableScopedPath) -> bool
fn contains_key(&self, k: &TableScopedPath) -> bool
Source§impl Default for DefaultListFilesCache
impl Default for DefaultListFilesCache
Source§impl ListFilesCache for DefaultListFilesCache
impl ListFilesCache for DefaultListFilesCache
Source§fn cache_limit(&self) -> usize
fn cache_limit(&self) -> usize
Source§fn cache_ttl(&self) -> Option<Duration>
fn cache_ttl(&self) -> Option<Duration>
Source§fn update_cache_limit(&self, limit: usize)
fn update_cache_limit(&self, limit: usize)
Source§fn update_cache_ttl(&self, ttl: Option<Duration>)
fn update_cache_ttl(&self, ttl: Option<Duration>)
Source§fn list_entries(&self) -> HashMap<TableScopedPath, ListFilesEntry>
fn list_entries(&self) -> HashMap<TableScopedPath, ListFilesEntry>
fn drop_table_entries(&self, table_ref: &Option<TableReference>) -> Result<()>
Auto Trait Implementations§
impl !Freeze for DefaultListFilesCache
impl !RefUnwindSafe for DefaultListFilesCache
impl Send for DefaultListFilesCache
impl Sync for DefaultListFilesCache
impl Unpin for DefaultListFilesCache
impl !UnwindSafe for DefaultListFilesCache
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> 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 more