Added sampler clearing

This commit is contained in:
Joshua Barretto 2019-06-08 11:10:31 +01:00
parent cf193a97c4
commit 3285fc9b88

View File

@ -117,6 +117,11 @@ impl<K: Hash + Eq + Copy, V> Cache<K, V> {
pub fn get<F: FnOnce(K) -> V>(&mut self, k: K, f: F) -> &V {
let counter = &mut self.counter;
if self.map.len() > self.capacity {
self.map.clear();
}
&self
.map
.entry(k)