Unverified Commit 01ca82d7 authored by Liangsheng Yin's avatar Liangsheng Yin Committed by GitHub
Browse files

fix radix cache match (#7)

parent 4bd8233f
......@@ -116,12 +116,12 @@ class RadixCache:
for c_key, child in node.children.items():
prefix_len = match(c_key, key)
if prefix_len != 0:
if prefix_len == len(key) and prefix_len != len(c_key):
if prefix_len < len(c_key):
new_node = self._split_node(c_key, child, prefix_len)
value.append(new_node.value)
last_node[0] = new_node
else:
value.append(child.value[:prefix_len])
value.append(child.value)
last_node[0] = child
self._match_prefix_helper(child, key[prefix_len:], value, last_node)
break
......
Markdown is supported
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