mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
Fix one and for all the ARC cache
This commit is contained in:
parent
b03ec3f603
commit
2b7b18fb5f
@ -306,9 +306,10 @@ impl<K: Eq + Hash + Clone, V> ArcCache<K, V> {
|
|||||||
return evicted;
|
return evicted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO not sure that I understand
|
|
||||||
if self.frequent_set.contains(&key) {
|
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;
|
return evicted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +336,9 @@ impl<K: Eq + Hash + Clone, V> ArcCache<K, V> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.p = (self.p + delta).min(self.capacity.get());
|
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);
|
self.recent_evicted.pop(&key);
|
||||||
if let Some(evicted_entry) = self.frequent_set.push(key, value) {
|
if let Some(evicted_entry) = self.frequent_set.push(key, value) {
|
||||||
evicted.push(evicted_entry);
|
evicted.push(evicted_entry);
|
||||||
|
Loading…
Reference in New Issue
Block a user