Skip to content

Commit ceae620

Browse files
committed
[lint] fix more issues
1 parent 64cbdd6 commit ceae620

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pkg/cache/options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func WithTTL(ttl time.Duration) Option {
2121
return func(o *options) {
2222
if ttl <= 0 {
2323
o.validUntil = time.Time{}
24+
return
2425
}
2526

2627
o.validUntil = time.Now().Add(ttl)

pkg/cache/redis.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ if ttlTs > 0 then
4141
redis.call('HExpireAt', KEYS[1], ttlTs, field)
4242
elseif ttlDelta > 0 then
4343
local ttl = redis.call('HTTL', KEYS[1], field)
44+
if ttl < 0 then
45+
ttl = 0
46+
end
4447
local newTtl = ttl + ttlDelta
4548
redis.call('HExpire', KEYS[1], newTtl, field)
4649
end

0 commit comments

Comments
 (0)