just cache the point id not the entire point (including the complete graph).
This commit is contained in:
parent
25af1c9901
commit
33ae8e4d37
1 changed files with 6 additions and 6 deletions
|
@ -387,11 +387,11 @@ class GraphLevel():
|
|||
def nearest_point(self, point, mode):
|
||||
cache_key = ('c3nav__routing__nearest_point__%s__%s__%.2f_%.2f__%s' %
|
||||
(self.graph.mtime, self.level.name, point[0], point[1], mode))
|
||||
points = cache.get(cache_key, None)
|
||||
if points is None:
|
||||
points = self._nearest_point(point, mode)
|
||||
cache.set(cache_key, points, 60)
|
||||
return points
|
||||
point = cache.get(cache_key, None)
|
||||
if point is None:
|
||||
point = self._nearest_point(point, mode)
|
||||
cache.set(cache_key, point, 60)
|
||||
return self.graph.points[point]
|
||||
|
||||
def _nearest_point(self, point, mode):
|
||||
points = self.connected_points(point, mode)
|
||||
|
@ -399,7 +399,7 @@ class GraphLevel():
|
|||
return None
|
||||
|
||||
nearest_point = min(points.items(), key=lambda x: x[1][0])
|
||||
return self.graph.points[nearest_point[0]]
|
||||
return nearest_point[0]
|
||||
|
||||
def connected_points(self, point, mode):
|
||||
cache_key = ('c3nav__routing__connected_points__%s__%s__%.2f_%.2f__%s' %
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue