aboutsummaryrefslogtreecommitdiffstats
path: root/cache/lru_id_cache.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache/lru_id_cache.go')
-rw-r--r--cache/lru_id_cache.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/cache/lru_id_cache.go b/cache/lru_id_cache.go
index e31f2843..a387cb75 100644
--- a/cache/lru_id_cache.go
+++ b/cache/lru_id_cache.go
@@ -9,20 +9,16 @@ import (
type LRUIdCache struct {
parentCache *lru.Cache
maxSize int
- onEvict func(id entity.Id)
}
-func NewLRUIdCache(size int, onEvicted func(id entity.Id)) (*LRUIdCache, error) {
- cache, err := lru.New(size)
- if err != nil {
- return nil, err
- }
+func NewLRUIdCache(size int) *LRUIdCache {
+ // Ignore error here
+ cache, _ := lru.New(size)
return &LRUIdCache{
cache,
size,
- onEvicted,
- }, nil
+ }
}
func (c *LRUIdCache) Add(id entity.Id) bool {
@@ -60,5 +56,6 @@ func (c *LRUIdCache) Remove(id entity.Id) bool {
}
func (c *LRUIdCache) Resize(size int) int {
+ c.maxSize = size
return c.parentCache.Resize(size)
}