From bda952070030b5eca8b6c6b855ddd9438048e210 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Fri, 1 Sep 2023 16:16:20 -0400 Subject: [PATCH] improved cache message - include entries and capacity --- src/util.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util.rs b/src/util.rs index 3611dfb70..0531b9008 100644 --- a/src/util.rs +++ b/src/util.rs @@ -357,13 +357,18 @@ macro_rules! update_cache_info { match $cache_instance.lock() { Ok(cache) => { - if cache.cache_size() > 0 { + let size = cache.cache_size(); + if size > 0 { let hits = cache.cache_hits().unwrap_or_default(); let misses = cache.cache_misses().unwrap_or(1); let hit_ratio = (hits as f64 / (hits + misses) as f64) * 100.0; + let capacity = cache.cache_capacity(); $progress.set_message(format!( - " of {} records. Cache hit ratio: {hit_ratio:.2}%", + " of {} records. Cache {:.2}% entries: {} capacity: {}.", HumanCount($progress.length().unwrap()), + hit_ratio, + HumanCount(size as u64), + HumanCount(capacity.unwrap() as u64), )); } },