Skip to content

Commit

Permalink
feat: update cache
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Dec 28, 2023
1 parent f04b7bb commit df87709
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/mito2/src/cache/file_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl FileCache {
return None;
}

let file_path = cache_file_path(&self.file_dir, key);
let file_path = self.cache_file_path(key);
match self.local_store.reader(&file_path).await {
Ok(reader) => {
CACHE_HIT.with_label_values(&[FILE_TYPE]).inc();
Expand All @@ -133,7 +133,7 @@ impl FileCache {

/// Removes a file from the cache explicitly.
pub(crate) async fn remove(&self, key: IndexKey) {
let file_path = cache_file_path(&self.file_dir, key);
let file_path = self.cache_file_path(key);
if let Err(e) = self.local_store.delete(&file_path).await {
warn!(e; "Failed to delete a cached file {}", file_path);
}
Expand Down Expand Up @@ -179,6 +179,16 @@ impl FileCache {

Ok(())
}

/// Returns the cache file path for the key.
pub(crate) fn cache_file_path(&self, key: IndexKey) -> String {
cache_file_path(&self.file_dir, key)
}

/// Returns the local store of the file cache.
pub(crate) fn local_store(&self) -> ObjectStore {
self.local_store.clone()
}
}

/// Key of file cache index.
Expand Down

0 comments on commit df87709

Please sign in to comment.