Flush Cache API (#103)

This commit is contained in:
Liangsheng Yin
2024-01-25 21:32:59 -08:00
committed by GitHub
parent 3a581e9949
commit 81561f8e2d
6 changed files with 48 additions and 64 deletions
@@ -30,14 +30,17 @@ def match(key, seq):
class RadixCache:
def __init__(self, disable=False):
self.reset()
self.disable = disable
##### Public API #####
def reset(self):
self.root_node = TreeNode()
self.root_node.value = []
self.root_node.ref_counter = 1
self.evictable_size_ = 0
self.disable = disable
##### Public API #####
def match_prefix(self, key):
if self.disable:
return [], self.root_node