Skip to content

Commit

Permalink
feature: add lru
Browse files Browse the repository at this point in the history
  • Loading branch information
Stone-afk committed Jan 11, 2024
1 parent 083d4f7 commit 799b8a2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions memory/lru/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,10 @@ func (c *Cache) removeElement(elem *element[entry]) {
}
}

func (c *Cache) remove(key string) (present bool) {
func (c *Cache) remove(key string) bool {
if elem, ok := c.data[key]; ok {
c.removeElement(elem)
if elem.Value.isExpired() {
return false
}
return true
return !elem.Value.isExpired()
}
return false

Check warning on line 170 in memory/lru/cache.go

View check run for this annotation

Codecov / codecov/patch

memory/lru/cache.go#L170

Added line #L170 was not covered by tests
}
Expand Down

0 comments on commit 799b8a2

Please sign in to comment.