示例#1
0
文件: fun.go 项目: qgweb/new
// 获取redis对象
func GetZJDxRedisObj() (*rediscache.MemCache, error) {
	rurls := strings.Split(GetConfVal("zhejiang::dx_redis_url"), ":")
	conf := rediscache.MemConfig{}
	conf.Host = rurls[0]
	conf.Port = rurls[1]
	return rediscache.New(conf)
}
示例#2
0
文件: fun.go 项目: qgweb/new
// 获取redis对象
func GetRedisObj() (*rediscache.MemCache, error) {
	rurls := strings.Split(GetConfVal("default::put_redis_url"), ":")
	conf := rediscache.MemConfig{}
	conf.Host = rurls[0]
	conf.Port = rurls[1]
	return rediscache.New(conf)
}
示例#3
0
文件: fun.go 项目: qgweb/new
// 获取redis对象
func GetPutRedisObj(key string) (conn *rediscache.MemCache, err error) {
	rurls := strings.Split(GetConfVal("default::"+key), ":")
	conf := rediscache.MemConfig{}
	conf.Host = rurls[0]
	conf.Port = rurls[1]
	conf.Db = rurls[2]
	conn, err = rediscache.New(conf)
	conn.SelectDb(conf.Db)
	return
}
示例#4
0
文件: fun.go 项目: qgweb/new
// 获取redis对象
func GetRedisObj(iniPath string, section string, db string) ([]*rediscache.MemCache, error) {
	confObj, err := GetConfObj(iniPath)
	if err != nil {
		return nil, errors.Trace(err)
	}
	conf := rediscache.MemConfig{}
	conf.Host = confObj.String(section + "::" + "host")
	conf.Port = confObj.String(section + "::" + "port")
	conf.Db = db
	return rediscache.NewMul(conf, 2)
}