From 44d9c51ff9e86da4b45e552797d4e379556c5dc4 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Mon, 6 Sep 2021 08:10:42 +0000 Subject: [PATCH] Fix logging --- src/library/cache.cr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/library/cache.cr b/src/library/cache.cr index 37359f2..0784363 100644 --- a/src/library/cache.cr +++ b/src/library/cache.cr @@ -161,7 +161,9 @@ class LRUCache end private def self.remove_least_recent_access - Logger.debug "Removing entries from LRUCache" if @@should_log + if @@should_log && is_cache_full + Logger.debug "Removing entries from LRUCache" + end while is_cache_full && @@cache.size > 0 min_tuple = @@cache.min_by { |_, entry| entry.atime } min_key = min_tuple[0]