MCPcopy Create free account
hub / github.com/cosdata/cosdata / evict

Method evict

src/models/lru_cache.rs:276–287  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

274 }
275
276 fn evict(&self) {
277 if self.map.len() > self.capacity {
278 match &self.evict_strategy {
279 EvictStrategy::Immediate => self.evict_lru(),
280 EvictStrategy::Probabilistic(prob) => {
281 if self.map.len() > self.capacity && prob.should_trigger() {
282 self.evict_lru_probabilistic(prob);
283 }
284 }
285 }
286 }
287 }
288
289 fn evict_lru(&self) {
290 let mut oldest_pair = None;

Callers 2

insertMethod · 0.80
get_or_insertMethod · 0.80

Calls 4

evict_lruMethod · 0.80
should_triggerMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected