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

Method remove_key

src/models/lru_cache.rs:89–99  ·  view source on GitHub ↗

Removes all instances of the specified key from the eviction index.

(&self, key: u64)

Source from the content-addressed store, hash-verified

87
88 /// Removes all instances of the specified key from the eviction index.
89 pub fn remove_key(&self, key: u64) {
90 for i in 0..self.inner.len() {
91 let slot = &self.inner[i];
92 let current = slot.load(Ordering::Acquire);
93 if current == key {
94 // Attempt to clear the slot if it still contains the key
95 let _ =
96 slot.compare_exchange(current, u64::MAX, Ordering::SeqCst, Ordering::Relaxed);
97 }
98 }
99 }
100}
101
102pub struct ProbEviction {

Callers 1

removeMethod · 0.80

Calls 2

loadMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected