12345678910111213141516171819202122232425 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package cache
- import "git.getensh.com/common/gopkgsv2/cache/redis"
- var redisCache *redis.Redis
- // Setup 建立连接
- func Setup(addrs []string, passwd string, db int,
- poolSize, minIdleConns, maxRetries int, cluster bool) {
- // 生成redis连接
- redisCache = redis.New(addrs, passwd, db, poolSize, minIdleConns, maxRetries, cluster)
- }
- // Redis 获取redis句柄
- func Redis() *redis.Redis {
- return redisCache
- }
- // Close 关闭
- func Close() {
- redisCache.Close()
- }
|