fix: address code review findings
This commit is contained in:
1 parent
0bba23692c
commit
82757665e9
6 files changed
+28
-33
No files matched your search
Vendored
+2
-5
@@ -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