diff options
author | zsfelfoldi <zsfelfoldi@gmail.com> | 2015-11-26 01:28:21 +0800 |
---|---|---|
committer | zsfelfoldi <zsfelfoldi@gmail.com> | 2015-12-01 08:38:32 +0800 |
commit | 52904ae32f0a591e7dccad7827ff1c2a73c27026 (patch) | |
tree | 9d6804d5b7594e57adb83dfd271598e37b81065d /trie/arc.go | |
parent | 66d47ced4892141cdc955856b9fce6e95bca0402 (diff) | |
download | go-tangerine-52904ae32f0a591e7dccad7827ff1c2a73c27026.tar.gz go-tangerine-52904ae32f0a591e7dccad7827ff1c2a73c27026.tar.zst go-tangerine-52904ae32f0a591e7dccad7827ff1c2a73c27026.zip |
trie: added error handling
Created alternate versions of Trie and SecureTrie functions that can return a MissingNodeError (used by ODR services)
Diffstat (limited to 'trie/arc.go')
-rw-r--r-- | trie/arc.go | 12 |
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 { |