@@ -6,16 +6,14 @@ package cache
66import (
77 "container/list"
88 "sync"
9-
10- "github.com/ava-labs/avalanchego/ids"
119)
1210
1311const (
1412 minCacheSize = 32
1513)
1614
1715type entry struct {
18- Key ids. ID
16+ Key interface {}
1917 Value interface {}
2018}
2119
@@ -24,29 +22,29 @@ type entry struct {
2422// done, based on evicting the least recently used value.
2523type LRU struct {
2624 lock sync.Mutex
27- entryMap map [ids. ID ]* list.Element
25+ entryMap map [interface {} ]* list.Element
2826 entryList * list.List
2927 Size int
3028}
3129
3230// Put implements the cache interface
33- func (c * LRU ) Put (key ids. ID , value interface {}) {
31+ func (c * LRU ) Put (key , value interface {}) {
3432 c .lock .Lock ()
3533 defer c .lock .Unlock ()
3634
3735 c .put (key , value )
3836}
3937
4038// Get implements the cache interface
41- func (c * LRU ) Get (key ids. ID ) (interface {}, bool ) {
39+ func (c * LRU ) Get (key interface {} ) (interface {}, bool ) {
4240 c .lock .Lock ()
4341 defer c .lock .Unlock ()
4442
4543 return c .get (key )
4644}
4745
4846// Evict implements the cache interface
49- func (c * LRU ) Evict (key ids. ID ) {
47+ func (c * LRU ) Evict (key interface {} ) {
5048 c .lock .Lock ()
5149 defer c .lock .Unlock ()
5250
@@ -63,7 +61,7 @@ func (c *LRU) Flush() {
6361
6462func (c * LRU ) init () {
6563 if c .entryMap == nil {
66- c .entryMap = make (map [ids. ID ]* list.Element , minCacheSize )
64+ c .entryMap = make (map [interface {} ]* list.Element , minCacheSize )
6765 }
6866 if c .entryList == nil {
6967 c .entryList = list .New ()
@@ -83,7 +81,7 @@ func (c *LRU) resize() {
8381 }
8482}
8583
86- func (c * LRU ) put (key ids. ID , value interface {}) {
84+ func (c * LRU ) put (key , value interface {}) {
8785 c .init ()
8886 c .resize ()
8987
@@ -111,7 +109,7 @@ func (c *LRU) put(key ids.ID, value interface{}) {
111109 }
112110}
113111
114- func (c * LRU ) get (key ids. ID ) (interface {}, bool ) {
112+ func (c * LRU ) get (key interface {} ) (interface {}, bool ) {
115113 c .init ()
116114 c .resize ()
117115
@@ -124,7 +122,7 @@ func (c *LRU) get(key ids.ID) (interface{}, bool) {
124122 return struct {}{}, false
125123}
126124
127- func (c * LRU ) evict (key ids. ID ) {
125+ func (c * LRU ) evict (key interface {} ) {
128126 c .init ()
129127 c .resize ()
130128
@@ -137,6 +135,6 @@ func (c *LRU) evict(key ids.ID) {
137135func (c * LRU ) flush () {
138136 c .init ()
139137
140- c .entryMap = make (map [ids. ID ]* list.Element , minCacheSize )
138+ c .entryMap = make (map [interface {} ]* list.Element , minCacheSize )
141139 c .entryList = list .New ()
142140}
0 commit comments