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

Method get_query_result

graphlite/src/cache/cache_manager.rs:217–249  ·  view source on GitHub ↗

Get cached query result

(
        &self,
        query: &str,
        parameters: Vec<CacheParameter>,
        user_context: Option<String>,
    )

Source from the content-addressed store, hash-verified

215
216 /// Get cached query result
217 pub fn get_query_result(
218 &self,
219 query: &str,
220 parameters: Vec<CacheParameter>,
221 user_context: Option<String>,
222 ) -> Option<(QueryResult, CacheHit)> {
223 if !self.config.enabled {
224 return None;
225 }
226
227 let graph_version = *self.graph_version.read().unwrap();
228 let key = create_query_cache_key(query, parameters, graph_version, user_context);
229
230 if let Some(cache_hit) = self.result_cache.get(&key) {
231 self.record_event(CacheEvent::ResultCacheHit {
232 key: key.clone(),
233 level: cache_hit.hit_level,
234 saved_time_ms: cache_hit.saved_execution_time.as_millis() as u64,
235 timestamp: Instant::now(),
236 });
237
238 // Get the actual result from the cache
239 // Note: This is a simplified version - in practice we'd need to extract the result
240 // from the cache hit or modify the cache to return the result directly
241 None // Placeholder - would return actual cached result
242 } else {
243 self.record_event(CacheEvent::ResultCacheMiss {
244 key,
245 timestamp: Instant::now(),
246 });
247 None
248 }
249 }
250
251 /// Cache query result
252 pub fn cache_query_result(

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected