Browse Source

(*)Redis设置PoolSize:10

dev
yfh 5 months ago
parent
commit
dad785ca05
  1. 16
      redisHelper.go

16
redisHelper.go

@ -31,7 +31,23 @@ func NewRedisHelper(master string, address ...string) *RedisHelper {
}
func (the *RedisHelper) InitialCluster(master string, address ...string) {
var opts *redis.UniversalOptions
if master != "" {
opts = &redis.UniversalOptions{Addrs: address, MasterName: "mymaster", PoolSize: 10}
} else {
opts = &redis.UniversalOptions{Addrs: address, PoolSize: 10}
}
the.rdb = redis.NewUniversalClient(opts)
if the.rdb == nil {
log.Fatal("Failed to initialize Redis client")
}
log.Printf("Redis client initialized with addresses: %s", address)
the.isReady = true
}
func (the *RedisHelper) InitialCluster_old(master string, address ...string) {
if master != "" {
the.rdb = redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: address,

Loading…
Cancel
Save