fix: address code review findings

This commit is contained in:
2026-08-17 20:34:17 +03:00
parent 0bba23692c
commit 82757665e9
6 changed files with 28 additions and 33 deletions

View File

@@ -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.