mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added sampler clearing
This commit is contained in:
parent
cf193a97c4
commit
3285fc9b88
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user