MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / evict_one

Method evict_one

nodedb/src/engine/sparse/doc_cache.rs:68–79  ·  view source on GitHub ↗

Evict the oldest (FIFO) entry from this shard. Returns `true` if an entry was removed.

(&mut self)

Source from the content-addressed store, hash-verified

66 /// Evict the oldest (FIFO) entry from this shard. Returns `true` if an
67 /// entry was removed.
68 fn evict_one(&mut self) -> bool {
69 while let Some(evicted) = self.order.pop_front() {
70 if self.entries.remove(&evicted).is_some() {
71 if let Some(count) = self.tenant_counts.get_mut(&evicted.tenant_id) {
72 *count = count.saturating_sub(1);
73 }
74 return true;
75 }
76 // Key was already removed (e.g., by `invalidate`); skip stale entry.
77 }
78 false
79 }
80}
81
82/// Bounded, database-sharded, weighted-LRU document cache.

Callers 1

Calls 3

pop_frontMethod · 0.80
removeMethod · 0.45
get_mutMethod · 0.45

Tested by

no test coverage detected