diff --git a/milli/src/update/index_documents/cache.rs b/milli/src/update/index_documents/cache.rs index abf81f828..47f0f44b1 100644 --- a/milli/src/update/index_documents/cache.rs +++ b/milli/src/update/index_documents/cache.rs @@ -306,9 +306,10 @@ impl ArcCache { return evicted; } - // TODO not sure that I understand if self.frequent_set.contains(&key) { - self.frequent_set.get(&key); + if let Some(evicted_entry) = self.frequent_set.push(key, value) { + evicted.push(evicted_entry); + } return evicted; } @@ -335,7 +336,9 @@ impl ArcCache { }; self.p = (self.p + delta).min(self.capacity.get()); - self.replace(&key); + if let Some(evicted_entry) = self.replace(&key) { + evicted.push(evicted_entry); + } self.recent_evicted.pop(&key); if let Some(evicted_entry) = self.frequent_set.push(key, value) { evicted.push(evicted_entry);