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

Method evict_tenant

nodedb/src/engine/timeseries/query_cache.rs:104–118  ·  view source on GitHub ↗

Evict all cached entries belonging to a specific tenant. Used during tenant purge to ensure zero residual cached data.

(&mut self, tenant_id: u64)

Source from the content-addressed store, hash-verified

102 ///
103 /// Used during tenant purge to ensure zero residual cached data.
104 pub fn evict_tenant(&mut self, tenant_id: u64) {
105 let keys: Vec<CacheKey> = self
106 .entries
107 .keys()
108 .filter(|&&(tid, _, _)| tid == tenant_id)
109 .copied()
110 .collect();
111
112 for key in keys {
113 if let Some(removed) = self.entries.remove(&key) {
114 self.current_bytes -= removed.len();
115 }
116 }
117 self.order.retain(|&(tid, _, _)| tid != tenant_id);
118 }
119
120 /// Number of cached entries.
121 pub fn len(&self) -> usize {

Callers 1

evict_tenantFunction · 0.45

Calls 3

collectMethod · 0.80
removeMethod · 0.45
lenMethod · 0.45

Tested by 1

evict_tenantFunction · 0.36