aboutsummaryrefslogtreecommitdiffstats
path: root/trie/arc.go
diff options
context:
space:
mode:
Diffstat (limited to 'trie/arc.go')
-rw-r--r--trie/arc.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/trie/arc.go b/trie/arc.go
index 9da012e16..fc7a3259f 100644
--- a/trie/arc.go
+++ b/trie/arc.go
@@ -62,6 +62,18 @@ func newARC(c int) *arc {
}
}
+// Clear clears the cache
+func (a *arc) Clear() {
+ a.mutex.Lock()
+ defer a.mutex.Unlock()
+ a.p = 0
+ a.t1 = list.New()
+ a.b1 = list.New()
+ a.t2 = list.New()
+ a.b2 = list.New()
+ a.cache = make(map[string]*entry, a.c)
+}
+
// Put inserts a new key-value pair into the cache.
// This optimizes future access to this entry (side effect).
func (a *arc) Put(key hashNode, value node) bool {