redis.go 861 字节
package cache

import (
	"fmt"

	"github.com/go-redis/redis"
)

var clientRedis *redis.Client

const (
	keyPrefix string = "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway"
)

func Init() *redis.Client {
	options := redis.Options{
		Network:            "tcp",
		Addr:               fmt.Sprintf("%s:%s", "127.0.0.1", "6379"),
		Dialer:             nil,
		OnConnect:          nil,
		Password:           "",
		DB:                 1,
		MaxRetries:         0,
		MinRetryBackoff:    0,
		MaxRetryBackoff:    0,
		DialTimeout:        0,
		ReadTimeout:        0,
		WriteTimeout:       0,
		PoolSize:           0,
		MinIdleConns:       0,
		MaxConnAge:         0,
		PoolTimeout:        0,
		IdleTimeout:        0,
		IdleCheckFrequency: 0,
		TLSConfig:          nil,
	}
	// 新建一个client
	clientRedis = redis.NewClient(&options)
	return clientRedis
}