Skip to content

Commit

Permalink
use delete instead of remove where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
karlseguin committed Nov 12, 2024
1 parent 61f5066 commit f9779b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func (c *Cache[T]) gc() int {
}
prev := item.prev
if !c.tracking || atomic.LoadInt32(&item.refCount) == 0 {
c.bucket(item.key).remove(item.key)
c.bucket(item.key).delete(item.key)
c.size -= item.size
c.list.Remove(item)
if c.onDelete != nil {
Expand Down
2 changes: 1 addition & 1 deletion layeredcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (c *LayeredCache[T]) gc() int {
}
prev := item.prev
if !c.tracking || atomic.LoadInt32(&item.refCount) == 0 {
c.bucket(item.group).remove(item.group, item.key)
c.bucket(item.group).delete(item.group, item.key)
c.size -= item.size
c.list.Remove(item)
if c.onDelete != nil {
Expand Down

0 comments on commit f9779b4

Please sign in to comment.