fix: address code review findings
This commit is contained in:
7
internal/cache/store.go
vendored
7
internal/cache/store.go
vendored
@@ -70,14 +70,11 @@ func (r *redisClient) Set(ctx context.Context, key *CacheKey, value []byte, ttl
|
||||
|
||||
// Exists checks if a key exists in cache.
|
||||
func (r *redisClient) Exists(ctx context.Context, key *CacheKey) (bool, error) {
|
||||
_, err := r.client.Exists(ctx, keyString(key)).Result()
|
||||
if errors.Is(err, redis.Nil) {
|
||||
return false, nil
|
||||
}
|
||||
count, err := r.client.Exists(ctx, keyString(key)).Result()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("cache exists: %w", err)
|
||||
}
|
||||
return true, nil
|
||||
return count > 0, nil
|
||||
}
|
||||
|
||||
// Delete removes a key from cache.
|
||||
|
||||
Reference in New Issue
Block a user