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

Method on_cache_hit

src/models/lru_cache.rs:59–68  ·  view source on GitHub ↗
(&self, old_counter: u32, new_counter: u32, key: u64)

Source from the content-addressed store, hash-verified

57 }
58
59 fn on_cache_hit(&self, old_counter: u32, new_counter: u32, key: u64) {
60 let i = Self::idx(old_counter);
61 if self.inner[i].load(Ordering::SeqCst) == key {
62 self.clear(i);
63 let j = Self::idx(new_counter);
64 if self.is_empty(j) {
65 self.inner[j].store(key, Ordering::SeqCst);
66 }
67 }
68 }
69
70 fn get_keys(&self, max: u8) -> Vec<(u8, u64)> {
71 let mut result = vec![];

Callers 3

getMethod · 0.80
get_or_insertMethod · 0.80
test_eviction_indexFunction · 0.80

Calls 3

loadMethod · 0.80
clearMethod · 0.80
is_emptyMethod · 0.45

Tested by 1

test_eviction_indexFunction · 0.64