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.go36
1 files changed, 18 insertions, 18 deletions
diff --git a/cache/lru_id_cache.go b/cache/lru_id_cache.go
index fda12ca6..0e5e31a7 100644
--- a/cache/lru_id_cache.go
+++ b/cache/lru_id_cache.go
@@ -8,49 +8,49 @@ import (
"github.com/MichaelMure/git-bug/entity"
)
-type LRUIdCache struct {
- parentCache *lru.Cache
+type lruIdCache struct {
+ lru *lru.Cache
}
-func NewLRUIdCache() *LRUIdCache {
+func newLRUIdCache() *lruIdCache {
// we can ignore the error here as it would only fail if the size is negative.
cache, _ := lru.New(math.MaxInt32)
- return &LRUIdCache{
+ return &lruIdCache{
cache,
}
}
-func (c *LRUIdCache) Add(id entity.Id) bool {
- return c.parentCache.Add(id, nil)
+func (c *lruIdCache) Add(id entity.Id) bool {
+ return c.lru.Add(id, nil)
}
-func (c *LRUIdCache) Contains(id entity.Id) bool {
- return c.parentCache.Contains(id)
+func (c *lruIdCache) Contains(id entity.Id) bool {
+ return c.lru.Contains(id)
}
-func (c *LRUIdCache) Get(id entity.Id) bool {
- _, present := c.parentCache.Get(id)
+func (c *lruIdCache) Get(id entity.Id) bool {
+ _, present := c.lru.Get(id)
return present
}
-func (c *LRUIdCache) GetOldest() (entity.Id, bool) {
- id, _, present := c.parentCache.GetOldest()
+func (c *lruIdCache) GetOldest() (entity.Id, bool) {
+ id, _, present := c.lru.GetOldest()
return id.(entity.Id), present
}
-func (c *LRUIdCache) GetOldestToNewest() (ids []entity.Id) {
- interfaceKeys := c.parentCache.Keys()
+func (c *lruIdCache) GetOldestToNewest() (ids []entity.Id) {
+ interfaceKeys := c.lru.Keys()
for _, id := range interfaceKeys {
ids = append(ids, id.(entity.Id))
}
return
}
-func (c *LRUIdCache) Len() int {
- return c.parentCache.Len()
+func (c *lruIdCache) Len() int {
+ return c.lru.Len()
}
-func (c *LRUIdCache) Remove(id entity.Id) bool {
- return c.parentCache.Remove(id)
+func (c *lruIdCache) Remove(id entity.Id) bool {
+ return c.lru.Remove(id)
}