mirror of https://github.com/harness/drone.git
[maint] fix cache decoder (#1150)
parent
2f5e79cee0
commit
c57ea55b82
|
@ -77,10 +77,12 @@ func (c *Redis[K, V]) Get(ctx context.Context, key K) (V, error) {
|
|||
|
||||
raw, err := c.client.Get(ctx, strKey).Result()
|
||||
if err == nil {
|
||||
c.countHit++
|
||||
return c.codec.Decode(raw)
|
||||
}
|
||||
if !errors.Is(err, redis.Nil) {
|
||||
value, decErr := c.codec.Decode(raw)
|
||||
if decErr == nil {
|
||||
c.countHit++
|
||||
return value, nil
|
||||
}
|
||||
} else if !errors.Is(err, redis.Nil) {
|
||||
return nothing, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue