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

Method invalidate_on_data_change

graphlite/src/cache/cache_manager.rs:419–446  ·  view source on GitHub ↗

Invalidate caches when graph data changes

(&self, table: Option<String>, affected_rows: u64)

Source from the content-addressed store, hash-verified

417
418 /// Invalidate caches when graph data changes
419 pub fn invalidate_on_data_change(&self, table: Option<String>, affected_rows: u64) {
420 let mut graph_version = self.graph_version.write().unwrap();
421 *graph_version += 1;
422
423 // Create invalidation event
424 let event = InvalidationEvent::DataUpdate {
425 table: table.unwrap_or_else(|| "unknown".to_string()),
426 affected_rows,
427 columns: vec![], // Could be enhanced to track specific columns
428 };
429
430 // Handle invalidation through the manager
431 let result = self.invalidation_manager.handle_event(event.clone());
432
433 // Invalidate result cache and subquery cache entries with old graph version
434 self.result_cache
435 .invalidate_by_graph_version(*graph_version);
436 self.subquery_cache
437 .invalidate_by_graph_version(*graph_version);
438
439 self.record_event(CacheEvent::Invalidation {
440 strategy: result.strategy_used,
441 affected_entries: result.entries_invalidated,
442 timestamp: Instant::now(),
443 });
444
445 self.update_global_stats();
446 }
447
448 /// Invalidate caches when schema changes
449 pub fn invalidate_on_schema_change(&self, table: String, change_type: String) {

Callers 3

execute_ddl_operationMethod · 0.80
execute_ddl_operationMethod · 0.80
execute_ddl_operationMethod · 0.80

Calls 6

unwrapMethod · 0.80
handle_eventMethod · 0.80
cloneMethod · 0.80
record_eventMethod · 0.80
update_global_statsMethod · 0.80

Tested by

no test coverage detected