Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rust/lance-core/src/cache/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

//! [`CacheBackend`] backed by [quick_cache](https://crates.io/crates/quick_cache),
//! whose hit path is one atomic bit — no read-op channel or inline
//! housekeeping. Used for the session index cache, which sees thousands of
//! cache reads per query.
//! housekeeping. Used for the session index and metadata caches; the index
//! cache sees thousands of cache reads per query.

use std::pin::Pin;

Expand Down
13 changes: 9 additions & 4 deletions rust/lance/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ impl Session {
///
/// - ***index_cache_size***: the size of the index cache, backed by
/// [`QuickCacheBackend`].
/// - ***metadata_cache_size***: the size of the metadata cache.
/// - ***metadata_cache_size***: the size of the metadata cache, backed by
/// [`QuickCacheBackend`].
/// - ***store_registry***: the object store registry to use when opening
/// datasets. This determines which schemes are available, and also allows
/// re-using object stores.
Expand All @@ -110,7 +111,9 @@ impl Session {
index_cache: GlobalIndexCache(LanceCache::with_backend(Arc::new(
QuickCacheBackend::with_capacity(index_cache_size),
))),
metadata_cache: GlobalMetadataCache(LanceCache::with_capacity(metadata_cache_size)),
metadata_cache: GlobalMetadataCache(LanceCache::with_backend(Arc::new(
QuickCacheBackend::with_capacity(metadata_cache_size),
))),
index_extensions: HashMap::new(),
store_registry,
spill_store: Arc::new(LocalSpillStore::default()),
Expand All @@ -120,15 +123,17 @@ impl Session {
/// Create a session with a custom index cache backend.
///
/// The provided backend will be used for caching index data. The metadata
/// cache will use the default Moka-based backend with the given capacity.
/// cache uses a [`QuickCacheBackend`] with the given capacity.
pub fn with_index_cache_backend(
index_cache_backend: Arc<dyn CacheBackend>,
metadata_cache_size: usize,
store_registry: Arc<ObjectStoreRegistry>,
) -> Self {
Self {
index_cache: GlobalIndexCache(LanceCache::with_backend(index_cache_backend)),
metadata_cache: GlobalMetadataCache(LanceCache::with_capacity(metadata_cache_size)),
metadata_cache: GlobalMetadataCache(LanceCache::with_backend(Arc::new(
QuickCacheBackend::with_capacity(metadata_cache_size),
))),
index_extensions: HashMap::new(),
store_registry,
spill_store: Arc::new(LocalSpillStore::default()),
Expand Down
Loading