Skip to content

Commit

Permalink
fix(expiration): don't add nottl items
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleSanderson authored Oct 25, 2024
1 parent 9d01666 commit 219818d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func New[K comparable, V any](opts ...Option[K, V]) *Cache[K, V] {
// Not safe for concurrent use by multiple goroutines without additional
// locking.
func (c *Cache[K, V]) updateExpirations(fresh bool, elem *list.Element) {
if elem.Value.(*Item[K, V]).ttl == NoTTL {
return
}

var oldExpiresAt time.Time

if !c.items.expQueue.isEmpty() {
Expand Down

0 comments on commit 219818d

Please sign in to comment.