From edd8284e318754c972d11d362121e8ebe37dcdbc Mon Sep 17 00:00:00 2001 From: Willy Phan Date: Fri, 4 Jul 2025 10:39:03 +0700 Subject: [PATCH] Fix bug in Cache.set(): self.map[query] is not defined in constructor, replaced it with self.lookup.get(query) --- solutions/system_design/query_cache/query_cache_snippets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/system_design/query_cache/query_cache_snippets.py b/solutions/system_design/query_cache/query_cache_snippets.py index 19d3f5cdd63..57d161f0b81 100644 --- a/solutions/system_design/query_cache/query_cache_snippets.py +++ b/solutions/system_design/query_cache/query_cache_snippets.py @@ -71,7 +71,7 @@ def set(self, results, query): If the entry is new and the cache is at capacity, removes the oldest entry before the new entry is added. """ - node = self.map[query] + node = self.lookup.get(query) if node is not None: # Key exists in cache, update the value node.results = results