more func

This commit is contained in:
Nikolay Volf 2016-02-17 23:34:55 +03:00
parent aad49cb19f
commit 95c74dbd30
1 changed files with 4 additions and 4 deletions

View File

@ -513,13 +513,13 @@ impl KeyDirectory {
if self.cache.borrow().len() <= MAX_CACHE_USAGE_TRACK { return; }
let uniqs: HashSet<&Uuid> = cache_usage.iter().collect();
let removes: Vec<Uuid> = {
let removes:Vec<Uuid> = {
let cache = self.cache.borrow();
cache.keys().cloned().filter(|key| !uniqs.contains(key)).collect()
};
for key in removes {
self.cache.borrow_mut().remove(&key);
}
if removes.is_empty() { return }
let mut cache = self.cache.borrow_mut();
for key in removes { cache.remove(&key); }
}
/// Reports how many keys are currently cached.