Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some tiny refactoring stuffs #8

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading