Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
f2eb7e7891
2 changed files with 2 additions and 3 deletions
  1. +1
    -1
      app/cfg/init_cache.go
  2. +1
    -2
      app/utils/cache/redis.go

+ 1
- 1
app/cfg/init_cache.go View File

@@ -5,5 +5,5 @@ import (
) )


func InitCache() { func InitCache() {
cache.NewRedis(RedisAddr, RedisPassword)
cache.NewRedis(RedisAddr)
} }

+ 1
- 2
app/utils/cache/redis.go View File

@@ -36,7 +36,7 @@ type Config struct {
var pool *redigo.Pool var pool *redigo.Pool
var conf *Config var conf *Config


func NewRedis(addr, password string) {
func NewRedis(addr string) {
if addr == "" { if addr == "" {
panic("\nredis connect string cannot be empty\n") panic("\nredis connect string cannot be empty\n")
} }
@@ -48,7 +48,6 @@ func NewRedis(addr, password string) {
Wait: true, Wait: true,
Dial: func() (redigo.Conn, error) { Dial: func() (redigo.Conn, error) {
c, err := redigo.Dial("tcp", addr, c, err := redigo.Dial("tcp", addr,
redigo.DialPassword(password),
redigo.DialConnectTimeout(redisDialTTL), redigo.DialConnectTimeout(redisDialTTL),
redigo.DialReadTimeout(redisReadTTL), redigo.DialReadTimeout(redisReadTTL),
redigo.DialWriteTimeout(redisWriteTTL), redigo.DialWriteTimeout(redisWriteTTL),


Loading…
Cancel
Save