-
Notifications
You must be signed in to change notification settings - Fork 49
cached execution statistics #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
test.py
Outdated
def test_cached_execution(self): | ||
redis_graph = Graph('cached', self.r) | ||
redis_graph.query("CREATE ()") | ||
uncached_result = redis_graph.query("MATCH (n) RETURN n") | ||
cached_result = redis_graph.query("MATCH (n) RETURN n") | ||
self.assertEqual(uncached_result.result_set, cached_result.result_set) | ||
self.assertFalse(uncached_result.cached_execution) | ||
self.assertTrue(cached_result.cached_execution) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't merge this until execution-plan cache is merged.
redisgraph/query_result.py
Outdated
return float(stat.split(': ')[1].split(' ')[0]) | ||
if(prop == "Cached execution"): | ||
value = stat.split(': ')[1].split(' ')[0] | ||
if value == "true": | ||
return True | ||
elif value == "false": | ||
return False | ||
else: | ||
return float(stat.split(': ')[1].split(' ')[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't "Cached execution" be 0 or 1.
this would save this clunky parsing.
redisgraph/query_result.py
Outdated
@@ -274,7 +268,7 @@ def indices_deleted(self): | |||
|
|||
@property | |||
def cached_execution(self): | |||
return self._get_stat(self.CACHED_EXECUTION) | |||
return True if self._get_stat(self.CACHED_EXECUTION) == 1 else False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return self._get_stat(self.CACHED_EXECUTION) == 1
No description provided.