删除redis
This commit is contained in:
1 parent
1f707e7be9
commit
fe4b83cbba
3 files changed
-65
No files matched your search
@@ -1,19 +0,0 @@
|
||||
package config
|
||||
|
||||
import "github.com/spf13/viper"
|
||||
|
||||
type RedisConn struct {
|
||||
Addr string
|
||||
Password string
|
||||
DB int
|
||||
}
|
||||
|
||||
func InitRedisConn(cfg *viper.Viper) *RedisConn {
|
||||
return &RedisConn{
|
||||
Addr: cfg.GetString("addr"),
|
||||
Password: cfg.GetString("password"),
|
||||
DB: cfg.GetInt("db"),
|
||||
}
|
||||
}
|
||||
|
||||
var RedisConnConfig = new(RedisConn)
|
||||
@@ -1,24 +0,0 @@
|
||||
settings:
|
||||
application:
|
||||
env: dev
|
||||
envmsg: "谢谢您的参与,但为了大家更好的体验,所以本次提交就算了吧!\U0001F600\U0001F600\U0001F600"
|
||||
host: 0.0.0.0
|
||||
isinit: true
|
||||
jwtsecret: 123abc
|
||||
logpath: temp/logs/log.log
|
||||
name: go-admin
|
||||
port: 8000
|
||||
readtimeout: 1
|
||||
writertimeout: 2
|
||||
database:
|
||||
database: dbname
|
||||
dbtype: mysql
|
||||
host: 127.0.0.1
|
||||
password: password
|
||||
port: 3306
|
||||
username: root
|
||||
redis:
|
||||
addr: 0.0.0.0:6379
|
||||
db: 0
|
||||
password: password
|
||||
readtimeout: 50
|
||||
@@ -1,22 +0,0 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/go-redis/redis"
|
||||
"go-admin/config"
|
||||
)
|
||||
|
||||
var RedisClient = new(redis.Client)
|
||||
|
||||
func init() {
|
||||
RedisNewClient(config.RedisConnConfig.Addr, config.RedisConnConfig.Password, config.RedisConnConfig.DB)
|
||||
}
|
||||
|
||||
func RedisNewClient(addr string, password string, db int) {
|
||||
//timeout := time.Duration(readTimeout)
|
||||
RedisClient = redis.NewClient(&redis.Options{
|
||||
Addr: addr,
|
||||
Password: password, // no password set
|
||||
DB: db, // use default DB
|
||||
//ReadTimeout: ,
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user