Skip to content

Commit

Permalink
fix: ensure that object cache insertions are weighted by size
Browse files Browse the repository at this point in the history
  • Loading branch information
sdd committed Aug 19, 2024
1 parent 263c929 commit 29812b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/iceberg/src/io/object_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ impl ObjectCache {
Self::with_disabled_cache(file_io)
} else {
Self {
cache: moka::future::Cache::new(cache_size_bytes),
cache: moka::future::Cache::builder()
.weigher(|_, val: &CachedItem| size_of_val(val) as u32)
.max_capacity(cache_size_bytes)
.build(),
file_io,
cache_disabled: false,
}
Expand Down

0 comments on commit 29812b1

Please sign in to comment.