MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / invalidate_by_schema

Method invalidate_by_schema

graphlite/src/cache/plan_cache.rs:281–304  ·  view source on GitHub ↗

Invalidate plans by schema hash

(&self, schema_hash: u64)

Source from the content-addressed store, hash-verified

279
280 /// Invalidate plans by schema hash
281 pub fn invalidate_by_schema(&self, schema_hash: u64) {
282 let mut entries = self.entries.write().unwrap();
283 let mut removed_size = 0;
284
285 entries.retain(|key, entry| {
286 if key.schema_hash == schema_hash {
287 removed_size += entry.size_bytes();
288 false
289 } else {
290 true
291 }
292 });
293
294 {
295 let mut current_memory = self.current_memory.write().unwrap();
296 *current_memory = current_memory.saturating_sub(removed_size);
297 }
298
299 {
300 let mut stats = self.stats.write().unwrap();
301 stats.current_entries = entries.len();
302 stats.current_memory_bytes = *self.current_memory.read().unwrap();
303 }
304 }
305
306 /// Get cache statistics
307 pub fn stats(&self) -> PlanCacheStats {

Callers 1

Calls 3

unwrapMethod · 0.80
size_bytesMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected