Skip to content

Commit 923a83f

Browse files
committed
[lint] fix more issues
1 parent 6398a12 commit 923a83f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pkg/cache/options.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ func (o *options) apply(opts ...Option) {
1919
// item will expire after the given duration from the time of insertion.
2020
func WithTTL(ttl time.Duration) Option {
2121
return func(o *options) {
22-
if ttl < 0 {
23-
ttl = 0
22+
switch {
23+
case ttl == 0:
24+
o.validUntil = time.Time{}
25+
case ttl < 0:
26+
o.validUntil = time.Now()
27+
default:
28+
o.validUntil = time.Now().Add(ttl)
2429
}
25-
26-
o.validUntil = time.Now().Add(ttl)
2730
}
2831
}
2932

0 commit comments

Comments
 (0)