Skip to content

Commit d215a32

Browse files
committed
Do early exit on nil value
1 parent b990574 commit d215a32

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

store/rueidis/rueidis.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,10 @@ func (s *RueidisStore) GetWithTTL(ctx context.Context, key any) (any, time.Durat
5757
res := s.client.DoCache(ctx, cmd, s.options.ClientSideCacheExpiration)
5858
str, err := res.ToString()
5959
if rueidis.IsRedisNil(err) {
60-
err = lib_store.NotFoundWithCause(err)
61-
}
62-
63-
ttl, getTtlErr := s.GetTTL(ctx, key)
64-
if getTtlErr == nil {
65-
return str, ttl, getTtlErr
60+
return res, time.Duration(0), lib_store.NotFoundWithCause(err)
6661
}
6762

63+
ttl, _ := s.GetTTL(ctx, key)
6864
return str, ttl, err
6965
}
7066

0 commit comments

Comments
 (0)