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

Method get_query_plan

graphlite/src/cache/cache_manager.rs:274–306  ·  view source on GitHub ↗

Get cached query plan

(
        &self,
        query_hash: u64,
        optimization_level: &str,
        hints: Vec<String>,
    )

Source from the content-addressed store, hash-verified

272
273 /// Get cached query plan
274 pub fn get_query_plan(
275 &self,
276 query_hash: u64,
277 optimization_level: &str,
278 hints: Vec<String>,
279 ) -> Option<PlanCacheEntry> {
280 if !self.config.enabled {
281 return None;
282 }
283
284 let schema_version = *self.schema_version.read().unwrap();
285 let key = create_plan_cache_key(
286 query_hash,
287 schema_version,
288 optimization_level,
289 hints.clone(),
290 );
291
292 if let Some(plan_entry) = self.plan_cache.get(&key) {
293 self.record_event(CacheEvent::PlanCacheHit {
294 key,
295 saved_time_ms: plan_entry.compilation_time.as_millis() as u64,
296 timestamp: Instant::now(),
297 });
298 Some(plan_entry)
299 } else {
300 self.record_event(CacheEvent::PlanCacheMiss {
301 key,
302 timestamp: Instant::now(),
303 });
304 None
305 }
306 }
307
308 /// Cache compiled query plan
309 pub fn cache_query_plan(

Callers

nothing calls this directly

Calls 5

create_plan_cache_keyFunction · 0.85
unwrapMethod · 0.80
cloneMethod · 0.80
record_eventMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected