Skip to content

Commit

Permalink
some tiny refactoring stuffs (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
prpeh committed Jun 14, 2024
1 parent d52d0de commit c42784a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ringcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ func (c *RingCache) Add(key, value interface{}) (evicted bool) {

// Get looks up a key's value from the cache.
func (c *RingCache) Get(key interface{}) (interface{}, bool) {
if value, ok := c.items[key]; ok {
return value, ok
}
return nil, false
value, ok := c.items[key]
return value, ok
}

// Contains checks if a key is in the cache, without updating the recent-ness
Expand All @@ -105,10 +103,9 @@ func (c *RingCache) Remove(key interface{}) bool {
if c.onEvict != nil {
c.onEvict(key, val)
}
break
return true
}
}
return true
}
return false
}
Expand Down

0 comments on commit c42784a

Please sign in to comment.