Skip to content

Commit

Permalink
save some memory
Browse files Browse the repository at this point in the history
  • Loading branch information
inpos committed Dec 24, 2024
1 parent 51d3321 commit 1ab1dfe
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,7 @@ func (c *Cache[K, V]) GetOrSetFunc(key K, fn func() V, opts ...Option[K, V]) (*I
}
applyOptions(&setOpts, opts...) // used only to update the TTL

value := fn()

item := c.set(key, value, setOpts.ttl)
item := c.set(key, fn(), setOpts.ttl)

return item, false
}
Expand Down

0 comments on commit 1ab1dfe

Please sign in to comment.