Skip to content

Commit

Permalink
moved now so we dont call it in every iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobht committed Dec 5, 2023
1 parent ec46e61 commit 1cc623e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/cache/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ func (c *lru) evictExpiredItems() {
return // do nothing if activelyEvict is not set
}

now := c.now()
for elt := c.byAccess.Back(); elt != nil; elt = c.byAccess.Back() {
if !c.isEntryExpired(elt.Value.(*entryImpl), c.now()) {
if !c.isEntryExpired(elt.Value.(*entryImpl), now) {
// List is sorted by item age, so we can stop as soon as we found first non expired item.
break
}
Expand Down

0 comments on commit 1cc623e

Please sign in to comment.