Ver Fonte

fix:redis集群

Roc há 1 ano atrás
pai
commit
c796d5ad9c
2 ficheiros alterados com 4 adições e 8 exclusões
  1. 2 4
      utils/redis/cluster_redis.go
  2. 2 4
      utils/redis/standalone_redis.go

+ 2 - 4
utils/redis/cluster_redis.go

@@ -186,10 +186,8 @@ func (rc *ClusterRedisClient) IsExist(key string) bool {
 		return false
 	}
 	if result == 0 {
-		err = rc.redisClient.HDel(context.TODO(), DefaultKey, key).Err()
-		if err != nil {
-			return false
-		}
+		_ = rc.redisClient.HDel(context.TODO(), DefaultKey, key).Err()
+		return false
 	}
 	return true
 }

+ 2 - 4
utils/redis/standalone_redis.go

@@ -178,10 +178,8 @@ func (rc *StandaloneRedisClient) IsExist(key string) bool {
 		return false
 	}
 	if result == 0 {
-		err = rc.redisClient.HDel(context.TODO(), DefaultKey, key).Err()
-		if err != nil {
-			return false
-		}
+		_ = rc.redisClient.HDel(context.TODO(), DefaultKey, key).Err()
+		return false
 	}
 	return true
 }