Commit a70a8f3a authored by Anton Hulikau's avatar Anton Hulikau Committed by Donne Martin
Browse files

Fix dict KeyError (#153)

parent e50e2007
......@@ -34,7 +34,7 @@ class Cache(object):
Accessing a node updates its position to the front of the LRU list.
"""
node = self.lookup[query]
node = self.lookup.get(query)
if node is None:
return None
self.linked_list.move_to_front(node)
......@@ -47,7 +47,7 @@ class Cache(object):
If the entry is new and the cache is at capacity, removes the oldest entry
before the new entry is added.
"""
node = self.lookup[query]
node = self.lookup.get(query)
if node is not None:
# Key exists in cache, update the value
node.results = results
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment